All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Successively incident (Posted on 2011-05-18)
All the base ten positive integers are written successively, without commas or spaces, resulting in this infinite string.

1234567891011121314......

Reading left to right, determine the digit following and the digit preceding the 2011th incidence of the digit 1. What is the digit following and the digit preceding the 20110th incidence of the digit 1?

 See The Solution Submitted by K Sengupta No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 Hand solution Comment 2 of 2 |
I had typed this in yesterday but it got lost when I hit send.  I know better.  Always type long answers into a word processor.  Anyhow this is a shorted (still longish) version that I think still shows my reasoning.

Define [a,b]=n where n is the number of 1s on the closed interval from a to b.

First some initial results:
[0,9]=1
[0,99]=20 (2 decimal places times 10 ones in each place)
[0,999]=300
[0,9999]=4000
[0,99999]=50000

[0,19]=12
[0,199]=140

[0,1999]=300+1000+300=1600
[0,2999]=1600+300=1900
[0,3099]=1900+20=1920
[0,3119]=1920+20+12=1952
[0,3129]=1952+11=1963
[0,3139]=1963+11=1974
[0,3149]=1973+11=1985
[0,3159]=1985+11=1996
[0,3169]=1996+11=2007
[0,3170]=2007+1=2008
[0,3171]=2009+2=2010
[0,3172]=2010+1=2011

So it is the 3172 that contains the 2011th 1.  So the following and preceding digits are 7 and 3 respectively.

[0,19999]=4000+10000+4000=18000
20110-18000=2110  which is only a bit more than the above.  The next ten thousand numbers start with a 2 so I can use some of the above results:
[0,22999]=18000+1900=19900
[0,23199]=19900+140=20040
[0,23299]=20040+20=20060
[0,23399]=20060+20=20080
[0,23499]=20080+20=20100
just need 10 more, so can just count.  It takes the next 17 numbers:
[0,23517]=20100+10=20110

So it is the 23517 that contains the 20110th 1.  So the following and preceding digits are 7 and 5 respectively.
 Posted by Jer on 2011-05-19 10:32:02

 Search: Search body:
Forums (0)