# A number riddle

• Dec 10th 2005, 06:08 PM
ThePerfectHacker
A number riddle
I created a riddle and supplied an answer, I happen to think it is interesting.
As one counts from 1 to 1000000000 how many times does one meet the number nine? An example: from 1 to 100 is 20 because of: 9, 19, 29, 39, 49, 59, 69, 79, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 and 99 counts as two! So how many times do I meet the number 9 from 1 to 1000000000? You can always count :) or find a pattern.

Okay the solution is this:
on the interval:
[1,10]=1
[1,100]=20
[1,1000]=300
[1,10000]=4000
[1,100000]=50000
See the pattern! We can in fact prove from [1,10^n] we meet the number nine n*10^(n-1) times. But the proof is ommitted here.

Tell me what you think of it?

Something interesting happens when we count to 10 trillion the number of times we meet 9 is also 10 trillion! Futhermore when the numbers start getting larger than 10 trillion the number of times we meet the nine exceedes the number we count until!
• Dec 11th 2005, 01:47 AM
Rich B.
Hi:

And interesting it is indeed!
For a 1 digit number, we see 9 once.

2 digits: __ __, __ __ , __ __ The 9 can show up in the 1st, 2nd, or both places. If it only appears in one position, then the other position can be filler by any of 9 digits. And it can show in both places only one way, i.e., 99, where we see the 9 twice. The total "n(2)" = (2c1)X9^1 + 2(2c2)X9^0 = 20.

Employing the same logic gives,
n(3) = (3c1)X9^2 + 2(3c2)X9^1 + 3(3c3)x9^0 = 300.
n(4) = (4c1)X9^3 + 2(4c2)X9^2 + 3(4c3)x9^1 + 4(4c4)x9^0 = 4000
.
.
.
n(k)= (kc1)x9^(k-1) + 2(kc2)x9^(k-2) +...+k(kck)x9^(k-k) = kX10^(k-1).

Hence, as the number of appearances in {0,1,2,...,10^9} is the same as those in {0,1,2,...,999999999}, the solution of your specific question is,
n(9) = 9X10^8 or 900,000,000.

With regard to proof, it should be fairly short business to demonstrate that
n(k)= kX10^(k-1) implies n(k+1)=(k+1)X10^[(k-1)+1] for k in {1,2,3,...}, making induction a reasonably "clean" course of action. ...best laid plans... :)

Regards,

Rich B.