For a positive integer N drawn at random between 3 and 202 inclusively, determine the probability that the base N number 2011 is expressible as the sum of squares of two distinct positive integers in at least one way.
In 58 out of the 200 cases, or 29%, does the desired result hold:
-----------------------decimal notation-----------
base N squares roots
3 9 49 3 7
8 9 1024 3 32
12 1444 2025 38 45
16 3025 5184 55 72
19 49 13689 7 117
20 3025 12996 55 114
24 12544 15129 112 123
27 1369 38025 37 195
28 17689 26244 133 162
29 9604 39204 98 198
33 10404 61504 102 248
36 324 93025 18 305
44 56169 114244 237 338
48 2209 219024 47 468
49 21904 213444 148 462
52 26244 255025 162 505
56 43264 308025 208 555
59 17689 393129 133 627
64 173889 350464 417 592
68 247009 381924 497 618
75 303601 540225 551 735
76 40804 837225 202 915
83 13689 1129969 117 1063
84 23409 1162084 153 1078
88 170569 1192464 413 1092
91 60025 1447209 245 1203
92 632025 925444 795 962
93 26244 1582564 162 1258
100 112225 1887876 335 1374
107 7225 2442969 85 1563
113 2704 2883204 52 1698
117 6400 3196944 80 1788
120 176400 3279721 420 1811
125 181476 3724900 426 1930
128 262144 3932289 512 1983
129 324 4293184 18 2072
131 950625 3545689 975 1883
133 5184 4700224 72 2168
139 804609 4566769 897 2137
140 335241 5152900 579 2270
145 45796 6051600 214 2460
147 38025 6315169 195 2513
148 223729 6260004 473 2502
152 1440000 5583769 1200 2363
157 2160900 5579044 1470 2362
160 463761 7728400 681 2780
161 2196324 6150400 1482 2480
163 613089 8048569 783 2837
168 769129 8714304 877 2952
176 5071504 5832225 2252 2415
180 1069156 10595025 1034 3255
181 5569600 6290064 2360 2508
184 369664 12089529 608 3477
187 1265625 11812969 1125 3437
188 3790809 9498724 1947 3082
189 3755844 9746884 1938 3122
196 82369 14976900 287 3870
197 7225344 8065600 2688 2840
DEFDBL A-Z
CLS
FOR n = 3 TO 202
v = 2 * n * n * n + n + 1
sr1 = 1: sq1 = 1: found = 0
DO
r = v - sq1
sr = INT(SQR(r) + .5)
IF sr * sr = r THEN
found = 1
EXIT DO
END IF
sr1 = sr1 + 1
sq1 = sr1 * sr1
LOOP UNTIL sq1 > v / 2
IF found = 1 AND sq1 <> r THEN
ctHit = ctHit + 1
PRINT n, sq1; r, sr1; sr
IF ctHit MOD 40 = 0 THEN
DO: LOOP UNTIL INKEY$ > "": PRINT
END IF
END IF
ct = ct + 1
NEXT n
PRINT
PRINT ctHit; ct, ctHit / ct
|
Posted by Charlie
on 2011-07-19 18:47:32 |