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

 Square String Settlement (Posted on 2010-01-28)
All the positive perfect squares 1, 4, 9, 16, 25.... are written in strictly ascending order of magnitude and without the commas and spaces, resulting in the following infinite string:

149162536496481100121144......

Reading left to right, what is the 2010th digit in the above pattern?

 See The Solution Submitted by K Sengupta Rating: 3.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 solution | Comment 3 of 8 |

There are 3 1-digit squares, 6 2-digit squares, etc., per the following table:

`                          digits     total digits   digits     number   accounted     accounted for                            for         thus far      1           3           3              3      2           6          12             15      3          22          66             81      4          68         272            353      5         217        1085           1438      6         683        4098           5536      7        2163       15141          20677      8        6837       54696          75373      9       21623      194607         269980     10       68377      683770         953750     `

So for example, the six 2-digit squares account for 12 digits in all, and added to the 3 digits from the single-digit squares, the result is 15, representing the total of the numbers of digits in all squares of two or fewer digits.

By the table, the squares with 5 or fewer digits account for 1438 digits, so we need to go the the (2010 - 1438)th or 572nd digit thereafter, among the 6-digit squares, making that the second digit (ten thousands position) in the 96th 6-digit square.

The last 5-digit square is the square of 3+6+22+68+217, or 316^2 = 99856, so the 96th 6-digit square is the square of 316 + 96, or 412^2 = 169744.

The digit in question, therefore, is 6.

For the above table:

DEFDBL A-Z
pwr = 10
FOR n = 1 TO 10
num = INT(SQR(pwr - 1))
numDiff = num - prevNum
prevNum = num
pwr = pwr * 10
totDig = totDig + n * numDiff
PRINT USING "############"; n; numDiff; n * numDiff; totDig
NEXT

Computer (brute force) verification:

list
5   S1="":S2=""
10   while len(S1)+len(S2)<2010
20    I=I+1
30    if len(S1)<1050 then S1=S1+cutspc(str(I*I)):else S2=S2+cutspc(str(I*I))

40   wend
60   print mid(S2,2010-len(S1),1)
OK
run
6
OK
?i*i
169744
OK

 Posted by Charlie on 2010-01-28 14:18:33

 Search: Search body:
Forums (0)