The cube of the next even positive integer is written beside the square of every odd positive integer in ascending order, without commas or spaces, resulting in this infinite pattern:
1896425216495128110001211728........
Determine the 2010th digit in the above pattern.
The largest 1-digit odd square is 9, so there are only two such squares.
For 2-digit odd squares they must be less than 100, and so are the squares of numbers from 5 to 9 and there are three of them.
The 3-digit odd squares are those of odd numbers from 11 to 31, of which there are eleven.
The 4-digit odd squares are those of odd numbers from 33 to 99, of which there are 34.
The 5-digit odd squares are those of odd numbers from 101 to 315, of which there are 108.
squares of #of digits cumulative
1 2 (1,3) 2 2
2 3 (5-9) 6 8
3 11 (11-31) 33 41
4 34 (33-99) 136 177
5 108 (101-315) 540 717
We can make a similar table for even cubes:
cubes of #of digits cumulative
1 1 (2) 1 1
2 1 (4) 2 3
3 2 (6,8) 6 9
4 6 (10-20) 24 33
5 13 (22-46) 65 98
6 26 (48-98) 156 254
7 58 (100-214) 406 660
8 125 (216-464) 1000 1660
So through the 316th segment, there are 717 digits provided by odd squares. The even cubes contribute 660 + 8*(316-214)/2 = 1068, making 1785 in all.
Thus there are 2010-1785=225 digits to go at 6+8=14 digits per pair of segments. That's 16 more full pairs plus one digit into the next. That takes us to the first digit of the (316+32+1)=349th segment. Since 349^2=121801 that digit is 1.
Corroboration:
list
10 while Curlen<2010
20 inc N
30 if n @ 2 = 1 then V=N*N:else V=N*N*N
40 News=cutspc(str(V)):Curlen=Curlen+len(News)
50 wend
60 Psn=2010-(Curlen-len(News))
65 D=mid(News,Psn,1)
70 print D,N,News,Psn
OK
run
1 349 121801 1
OK
showing the digit, the number whose square is shown and the position within that square from which the digit was taken.
|
Posted by Charlie
on 2010-04-27 18:19:11 |