wu :: forums (http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi)
riddles >> easy >> Functional Equation
(Message started by: THUDandBLUNDER on Oct 15th, 2004, 6:41am)

Title: Functional Equation
Post by THUDandBLUNDER on Oct 15th, 2004, 6:41am
Consider a function which, for a given integer n, returns the number of 1s required to write out all of the integers between
0 and n.

For example, f(13) = 6

After F(1) = 1, what is the next n such that f(n) = n?


Title: Re: Functional Equation
Post by Fresno_Bob on Oct 15th, 2004, 11:10am
Here's a shot at it
[hide]

f(999,999,999) = 900,000,000
f(1,099,999,999) = f(999,999,999) + 100,000,000 + 80,000,000 = 1,080,000,000
f(1,109,999,999) = f(1,099,999,999) + 20,000,000 + 7,000,000 = 1,107,000,000
f(1,110,999,999) = f(1,109,999,999) + 3,000,000 + 600,000    = 1,110,600,000
f(1,111,099,999) = f(1,110,999,999) + 400,000 + 50,000       = 1,111,050,000
f(1,111,109,999) = f(1,111,099,999) + 50,000 + 4,000         = 1,111,104,000
f(1,111,110,999) = f(1,111,109,999) + 6,000 + 300            = 1,111,110,300
f(1,111,111,099) = f(1,111,110,999) + 700 + 20               = 1,111,111,020
f(1,111,111,109) = f(1,111,111,099) + 80 + 1                 = 1,111,111,101
f(1,111,111,110) = f(1,111,111,109) + 9                      = 1,111,111,110

1,111,111,110
[/hide]



Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board