This problem is one of a family of related problems:
So we're looking for triples of positive integers a,b,c where all of three permutations of the not-quite-sums-of-squares a+b2+c2, a2+b+c2, and a2+b2+c are perfect squares.
The fully generic problem is the most interesting one, but there will be interesting - or boring, depending on your point of view - sub-families of results where two or even three of the variables are equal.
If there was nothing special about the distribution of solutions in ℤ3, then the "volume" of the search space for each of these classes is incomparable. The a=b=c case is just a line, the a=b and b=c cases are planes, and the generic case is the full rest of the solid region. One might therefore expect almost none of the solutions to be the special cases, but those special properties might enable them to have an unexpected density to their solutions.
Of course, the solutions where these planes intersect is precisely the set of solutions along the diagonal; and of course, the solutions on the planes are precisely the intersection of the planes with the solutions to the generic version of the problem. There is only one problem being solved, we're just slicing it different ways.
Note that the a=b=c case is a simple quadratic diophantine equation 2·a2+a=d2, expressable as a pell equation (4·a+1)2-2·(2·d)2=1. The infinite family of solutions for this equation is known, they are derived from the subset of the solutions to the classic Pell's Equation x2-2·y2=1, with x restricted to numbers of the form 4a+1, and y even. This restriction gives them more in common with the approximants to √32, than those of just √2. This gives them a known density, they grow, and thus thin out, exponentially. They are marked up thusly in the results table.
The a=b and b=c cases (by symmetry, these are the same case, but I've ordeded a,b, and c, so they superficially fall into two subfamilies: one-small-two-big, and two-small-one-big) also have a well-studied algebraic property, based on a similar substitution as performed above. a2+a+c2=d2 is precisely 4·a2+4·a+1+4·c^2=4·d^2+1, so (2·a+1)^2+(2·c)^2=(2·d)^2+1, so this is an instance of the "x2+y2-z2=1" problem, the hyperboloid of one sheet, with solutions as documented out there in internet land.
Of course, our solutions also need to satisfy 2·a2+c=f2, so are a very small subset of the solutions to that simpler problem. Some proper mathematician needs to have a look at this, I don't have the chops.
No clue - if you can extract anything from the known solutions, or hit this with actual maths, drop me a note. The solutions a≠b≠c are higlighted thus in the table of results.
One thing's certain - this is tractible, and the right mind will probably solve it easily. In fact, it seems Diophantus would have solved it, as he solved a harder problem, Diophantus Problem III.19 (page 8).
a | b | c | √(a+b2+c2) | √(a2+b+c2) | √(a2+b2+c) | Notes |
---|---|---|---|---|---|---|
4 | 4 | 4 | 6 | Baudhayana's x=17, y=12 | ||
24 | 24 | 73 | 77 | 35 | ||
31 | 135 | 135 | 191 | 139 | ||
144 | 144 | 144 | 204 | Baudhayana's x=577, y=408 | ||
63 | 63 | 162 | 174 | 90 | ||
137 | 224 | 224 | 317 | 263 | ||
136 | 136 | 257 | 291 | 193 | a2+b2+c2=3212 - spooky! | |
48 | 48 | 292 | 296 | 70 | ||
68 | 304 | 304 | 430 | 312 | ||
160 | 240 | 321 | 401 | 359 | 289 | |
388 | 516 | 516 | 730 | 646 | ||
376 | 376 | 1337 | 1389 | 533 | ||
495 | 495 | 1351 | 1439 | 701 | ||
935 | 935 | 1879 | 2099 | 1323 | ||
959 | 959 | 2087 | 2297 | 1357 | ||
607 | 1791 | 3534 | 3962 | 3586 | 1892 | |
304 | 3449 | 4352 | 5553 | 4363 | 3463 | |
3649 | 4864 | 4864 | 6879 | 6081 | ||
4900 | 4900 | 4900 | 6930 | Pell x=19601, y=13860 | ||
868 | 868 | 6052 | 6114 | 1230 | ||
5138 | 6467 | 6467 | 9146 | 8260 | ||
1921 | 7240 | 7240 | 10239 | 7491 | ||
1424 | 8720 | 8720 | 12332 | 8836 | ||
336 | 336 | 9433 | 9439 | 485 | ||
2761 | 5856 | 9768 | 11389 | 10151 | 6475 | |
8439 | 8439 | 10783 | 13693 | 11935 | ||
9697 | 12208 | 12208 | 17265 | 15591 | ||
2480 | 2480 | 12281 | 12529 | 3509 | ||
1230 | 6051 | 15475 | 16616 | 15524 | 6176 | |
1859 | 1859 | 15662 | 15772 | 2632 | ||
14180 | 14180 | 18116 | 23006 | 20054 | ||
5430 | 9595 | 23751 | 25616 | 24364 | 11026 | |
15599 | 15599 | 30119 | 33919 | 22061 | ||
16712 | 16712 | 31337 | 35515 | 23635 | ||
19876 | 24036 | 31428 | 39566 | 37186 | 31190 | |
11192 | 11192 | 35513 | 37235 | 15829 | ||
1447 | 7034 | 38891 | 39522 | 38918 | 7184 | |
9088 | 9088 | 41828 | 42804 | 12854 | ||
28401 | 54304 | 64872 | 84601 | 70817 | 61283 | |
1550 | 6179 | 70835 | 71104 | 70852 | 6376 | |
2671 | 78375 | 78375 | 110839 | 78421 | ||
28548 | 28548 | 83268 | 88026 | 40374 | ||
4080 | 4080 | 138724 | 138784 | 5782 | ||
23828 | 23828 | 142832 | 144806 | 33700 | ||
4488 | 4488 | 152593 | 152659 | 6359 | ||
34007 | 155311 | 155311 | 219643 | 158991 | ||
17160 | 50041 | 160128 | 167765 | 161045 | 52903 | |
16607 | 53471 | 163774 | 172282 | 164614 | 55992 | |
106948 | 163968 | 163968 | 231886 | 195764 | ||
107635 | 148515 | 164274 | 221456 | 196396 | 183418 | |
166464 | 166464 | 166464 | 235416 | Pell x=665857, y=470832 | ||
11583 | 11583 | 169218 | 169614 | 16386 | ||
93103 | 184431 | 184431 | 260825 | 206599 | ||
5184 | 5184 | 186624 | 186696 | 7344 | ||
26279 | 26279 | 214207 | 215813 | 37167 | ||
83417 | 220048 | 220048 | 311195 | 235329 | ||
123112 | 129041 | 221576 | 256413 | 253481 | 178349 | |
12831 | 12831 | 225982 | 226346 | 18152 | ||
36743 | 36743 | 265127 | 267661 | 51965 | ||
5304 | 5304 | 270529 | 270581 | 7519 | ||
141855 | 141855 | 294946 | 327286 | 200614 | ||
35320 | 35320 | 297409 | 299499 | 49953 | ||
27936 | 257076 | 298228 | 393736 | 299534 | 258590 | |
42484 | 42484 | 306544 | 309474 | 60084 | ||
16400 | 16400 | 320000 | 320420 | 23200 | ||
76708 | 350336 | 350336 | 495450 | 358636 | ||
47399 | 47399 | 360823 | 363923 | 67035 | ||
5571 | 5571 | 369522 | 369564 | 7902 | ||
191552 | 379456 | 379456 | 536632 | 425064 | ||
5236 | 5236 | 403232 | 403266 | 7432 | ||
78064 | 78064 | 404609 | 412071 | 110401 | ||
25751 | 25751 | 406927 | 407741 | 36423 | ||
110768 | 110768 | 436153 | 449999 | 156651 | ||
8568 | 8568 | 436977 | 437061 | 12135 | ||
14344 | 14344 | 467537 | 467757 | 20297 | ||
236340 | 236340 | 512496 | 564366 | 334236 | ||
77796 | 197860 | 514020 | 550786 | 519874 | 212606 | |
73731 | 288003 | 544894 | 616324 | 549860 | 297292 | |
28831 | 28831 | 555278 | 556026 | 40780 | ||
130400 | 130400 | 572225 | 586895 | 184415 | ||
54594 | 586719 | 586719 | 829746 | 589254 | ||
446761 | 595680 | 595680 | 842419 | 744601 | ||
343519 | 658119 | 658119 | 930721 | 742379 | ||
23391 | 23391 | 670338 | 670746 | 33090 | ||
15911 | 15911 | 695447 | 695629 | 22517 | ||
438873 | 591232 | 881808 | 1061669 | 984985 | 736319 | |
421767 | 898623 | 898623 | 1270845 | 992679 | ||
56614 | 256775 | 1001515 | 1033908 | 1003114 | 262944 | |
346040 | 737033 | 1025936 | 1263235 | 1082723 | 814225 | |
70161 | 250264 | 1171608 | 1198039 | 1173707 | 259915 | |
430787 | 430787 | 1440338 | 1503380 | 609226 | ||
518017 | 606856 | 1464664 | 1585407 | 1553571 | 797883 | |
434384 | 434384 | 1543057 | 1603033 | 614313 | ||
215379 | 534291 | 1658578 | 1742512 | 1672504 | 576070 | |
89540 | 169856 | 1671920 | 1680526 | 1674316 | 192016 | |
347843 | 347843 | 1684178 | 1719724 | 491926 | ||
762559 | 1043343 | 1707351 | 2000903 | 1869905 | 1292309 | |
291744 | 355608 | 1709641 | 1746233 | 1734355 | 459971 | |
272648 | 563081 | 1988696 | 2066875 | 2007299 | 625619 | |
506880 | 506880 | 2049444 | 2111196 | 716838 | ||
628511 | 628511 | 2168258 | 2257514 | 888850 | ||
22419 | 22419 | 2204478 | 2204592 | 31740 | ||
339766 | 473447 | 2234939 | 2284536 | 2260618 | 582748 | |
823536 | 823536 | 2841057 | 2958009 | 1164657 | ||
275984 | 275984 | 2875904 | 2889116 | 390304 | ||
415079 | 415079 | 3109687 | 3137267 | 587013 | ||
29524 | 29524 | 3572464 | 3572586 | 41796 | ||
287024 | 920260 | 3908080 | 4014968 | 3918606 | 963984 | |
11808 | 11808 | 4357513 | 4357529 | 16829 | ||
1494975 | 1494975 | 4564975 | 4803535 | 2114215 | ||
2492561 | 4803920 | 4803920 | 6793769 | 5412071 | ||
7824 | 7824 | 5101897 | 5101903 | 11293 | close to axis | |
779796 | 1074036 | 5212912 | 5322406 | 5270914 | 1327268 | |
1215519 | 1215519 | 5311303 | 5448617 | 1719005 | ||
1525438 | 3539487 | 5409087 | 6464224 | 5620070 | 3854210 | |
5457312 | 5457312 | 5487337 | 7739065 | 7717805 | close body-diagonal | |
4209952 | 5613268 | 5613268 | 7938360 | 7016586 | ||
1053312 | 1053312 | 5613412 | 5711380 | 1489610 | ||
5654884 | 5654884 | 5654884 | 7997214 | Pell x=22619537, y=15994428 | ||
1812864 | 1812864 | 5868292 | 6141932 | 2563778 | ||
464847 | 5139879 | 6106399 | 7981633 | 6124067 | 5160857 | |
813503 | 1103903 | 6161207 | 6259319 | 6214681 | 1371275 | |
166803 | 166803 | 7046482 | 7048456 | 235910 | ||
51935 | 51935 | 7173566 | 7173754 | 73496 | ||
143104 | 143104 | 7440772 | 7442148 | 202398 | ||
30600 | 30600 | 7803225 | 7803285 | 43365 | ||
20708 | 20708 | 8246948 | 8246974 | 29426 | ||
8309038 | 8366787 | 8366787 | 11832424 | 11791660 | close body-diagonal | |
200264 | 200264 | 8459969 | 8462339 | 283231 | ||
697183 | 697183 | 8569922 | 8598234 | 985970 | ||
6846035 | 6846035 | 8801086 | 11150216 | 9681756 | ||
811737 | 6959368 | 8972808 | 11355355 | 9009451 | 7006549 | |
8634755 | 8634755 | 9066494 | 12520396 | 12211388 | ||
39984 | 39984 | 9516388 | 9516472 | 56630 | ||
7699923 | 7699923 | 10109038 | 12707536 | 10889336 | ||
2786087 | 6174187 | 10333562 | 12037570 | 10702560 | 6773690 | |
988283 | 4247798 | 10425607 | 11257756 | 10472344 | 4361250 | |
3312991 | 3312991 | 11205122 | 11684634 | 4685278 | ||
1907156 | 1907156 | 11431712 | 11589706 | 2697128 | ||
2126164 | 2126164 | 12240112 | 12423402 | 3006852 | ||
396488 | 2819033 | 12272728 | 12592331 | 12279131 | 2846781 | |
2656841 | 4926584 | 13147288 | 14040029 | 13413053 | 5597325 | |
941328 | 1747216 | 13161360 | 13276828 | 13194980 | 1984660 | |
910376 | 1984841 | 14575568 | 14710091 | 14603971 | 2183665 | |
14888417 | 14991896 | 14991896 | 21201743 | 21128699 | closest body-diagonal | |
907136 | 907136 | 15307108 | 15333964 | 1282890 | ||
15259864 | 15259864 | 16022857 | 22126803 | 21580707 | ||
11118483 | 11118483 | 17245522 | 20518984 | 15723910 | ||
3131842 | 6125791 | 17353471 | 18402942 | 17633814 | 6879954 | |
4051399 | 4051399 | 18192623 | 18638277 | 5729545 | ||
11476436 | 11476436 | 18213232 | 21527434 | 16230132 | ||
1861524 | 1861524 | 18494064 | 18587514 | 2632596 | ||
208382 | 18580099 | 18580099 | 26276228 | 18581268 | close face-diagonal | |
1449968 | 1449968 | 18821713 | 18877481 | 2050569 | ||
1799343 | 1799343 | 18962983 | 19048159 | 2544659 | ||
2223934 | 15436479 | 20402367 | 25584008 | 20523218 | 15595858 | |
1994368 | 1994368 | 21018308 | 21112716 | 2820466 | ||
1474599 | 1474599 | 21250807 | 21301907 | 2085403 | ||
2240959 | 2240959 | 21483842 | 21600402 | 3169198 | ||
1833872 | 1833872 | 22542313 | 22616785 | 2593491 | ||
200679 | 200679 | 22726567 | 22727453 | 283843 | ||
10615078 | 10731591 | 22822635 | 25219828 | 25170470 | 15094600 | |
1011188 | 1011188 | 23499248 | 23520994 | 1430044 | ||
254116 | 254116 | 25665188 | 25666446 | 359410 | ||
188255 | 188255 | 25680911 | 25681601 | 266281 | ||
5024080 | 17182056 | 25879905 | 31064329 | 26363059 | 17901521 | |
23903441 | 27159320 | 27159320 | 38409079 | 36180149 | ||
17743592 | 17743592 | 27521513 | 32745515 | 25093229 | ||
9783808 | 9783808 | 28634297 | 30259641 | 13836395 | ||
221368 | 221368 | 29663033 | 29663859 | 313109 | ||
14143369 | 31675440 | 31675440 | 44795837 | 34689601 | ||
6966036 | 11152240 | 32486580 | 34347494 | 33225044 | 13149074 | |
294099 | 294099 | 32614162 | 32615488 | 415958 | ||
1711600 | 1711600 | 34210625 | 34253415 | 2420575 | ||
2544167 | 35316731 | 35445254 | 50036362 | 35536444 | 35408252 | |
1990788 | 8694852 | 35859652 | 36898714 | 35914870 | 8919850 | |
21732104 | 33687233 | 38772824 | 51363037 | 44447905 | 40088827 | |
156215 | 3045719 | 39620255 | 39737149 | 39620563 | 3049729 | |
7751450 | 18913019 | 39706855 | 43981094 | 40456388 | 20439846 | |
5726079 | 13987935 | 40923010 | 43247602 | 41321674 | 15114574 | |
4392584 | 14478961 | 41307032 | 43771123 | 41539929 | 15130603 | |
7596944 | 24451169 | 41741528 | 48375767 | 42427217 | 25604165 | |
2055695 | 2055695 | 42159551 | 42209639 | 2907199 | ||
5299359 | 14850783 | 42540706 | 45058378 | 42869510 | 15767974 | |
368456 | 25895881 | 45050912 | 51963269 | 45052419 | 25898503 | |
828639 | 828639 | 45675022 | 45682538 | 1171892 | ||
40744369 | 49638584 | 49638584 | 70199559 | 64219099 | ||
69183 | 69183 | 49857858 | 49857906 | 98094 | ||
2344212 | 2344212 | 50368288 | 50422810 | 3315224 | ||
78328 | 78328 | 52890953 | 52891011 | 111011 | ||
1366384 | 1753929 | 53070384 | 53099359 | 53087971 | 2223359 | |
14829311 | 39207839 | 53576258 | 66390286 | 55590682 | 41918530 | |
876288 | 876288 | 56079073 | 56085919 | 1239281 | ||
9194824 | 9194824 | 57099857 | 57835443 | 13003447 | ||
304095 | 304095 | 60837826 | 60838586 | 430126 | ||
26827766 | 48287611 | 62823047 | 79236536 | 68311524 | 55239682 | |
1678520 | 1678520 | 62911601 | 62933989 | 2373799 | ||
22228798 | 63854483 | 63854483 | 90303876 | 67612976 | ||
19732169 | 37461928 | 64388744 | 74493667 | 67344405 | 42340933 | |
12705025 | 28749200 | 65188616 | 71246559 | 66415159 | 31431421 | |
3192384 | 3192384 | 65471488 | 65549272 | 4514720 | ||
30587647 | 30587647 | 66747938 | 73422690 | 43257466 | ||
2268895 | 2268895 | 70074319 | 70111041 | 3208713 | ||
14474079 | 45884286 | 70387807 | 84022682 | 71860576 | 48113062 | |
4402411 | 24370646 | 73637863 | 77565864 | 73769344 | 24765090 | |
16609112 | 55488281 | 76542616 | 94539523 | 78323909 | 57920739 | |
15946791 | 42846447 | 78910231 | 89792219 | 80505433 | 45717811 | |
1905281 | 2547728 | 82337744 | 82377151 | 82359785 | 3181367 | |
5924039 | 51489451 | 84935962 | 99324122 | 85142304 | 51829122 | |
15895600 | 15895600 | 85330625 | 86798535 | 22479775 | ||
40844864 | 87025040 | 87025040 | 123071992 | 96133556 | ||
1912464 | 1912464 | 89110609 | 89131129 | 2704649 | ||
16257456 | 56622265 | 92098200 | 108111791 | 93522101 | 58909981 | |
13924944 | 13924944 | 92159137 | 93205207 | 19692847 | ||
14364063 | 14364063 | 93225087 | 94325199 | 20313855 | ||
80496103 | 80496103 | 95446543 | 124858581 | 113838681 | ||
32945208 | 32945208 | 96090193 | 101581061 | 46591561 | ||
637439 | 637439 | 97580399 | 97582481 | 901529 | ||
21010351 | 21010351 | 98979223 | 101184591 | 29713125 | ||
15267800 | 22263440 | 99214729 | 101681971 | 100382609 | 26995677 | |
85109391 | 88982983 | 103053519 | 136154321 | 133654915 | 123132367 | |
91335479 | 107130335 | 107130335 | 151505173 | 140780249 | ||
902312 | 902312 | 110080337 | 110084035 | 1276105 | ||
25461504 | 25461504 | 124212004 | 126794756 | 36008006 | ||
59252562 | 62410323 | 127997203 | 142402010 | 141046624 | 86057624 | |
372824 | 372824 | 133139689 | 133140211 | 527379 | ||
61873904 | 61873904 | 141094793 | 154065313 | 87502915 | ||
58309175 | 58309175 | 149125879 | 160120229 | 82461627 | ||
79632175 | 94643231 | 150786895 | 178028169 | 170522641 | 123687609 | |
18712071 | 29289670 | 156751035 | 159464014 | 157863956 | 34756676 | |
148104 | 148104 | 166173777 | 166173843 | 209847 | close to axis | |
2583303 | 2583303 | 167043607 | 167063581 | 3653365 | ||
92170994 | 167950915 | 167950915 | 237518462 | 191580276 | ||
51917655 | 51917655 | 172160359 | 179818331 | 73422653 | ||
39242287 | 179228279 | 179228279 | 253467063 | 183474067 | ||
39168687 | 58251751 | 188427519 | 197226257 | 192455491 | 70195817 | |
192099600 | 192099600 | 192099600 | 271669860 | Pell x=768398401 y=543339720 | ||
8342521 | 21284864 | 197766512 | 198908619 | 197942393 | 22861393 | |
191706322 | 200127891 | 200127891 | 283023578 | 277132616 | ||
70034088 | 139300264 | 202539921 | 245819005 | 214306307 | 155914519 | |
35376275 | 35376275 | 211000850 | 213945880 | 50029610 | ||
18621855 | 18621855 | 216078606 | 216879546 | 26335284 | ||
4990719 | 4990719 | 218855842 | 218912738 | 7057958 | ||
2421489 | 161484624 | 227324344 | 278843399 | 227337241 | 161502779 | |
26788724 | 26788724 | 242504048 | 243979198 | 37884980 | ||
42001384 | 42001384 | 250516129 | 254012691 | 59398929 | ||
201302654 | 253493855 | 253493855 | 358494448 | 323700314 | ||
209668 | 209668 | 255586468 | 255586554 | 296946 | close to axis | |
160585505 | 253114160 | 259250504 | 362322511 | 304956601 | 299757373 | |
83730387 | 83730387 | 265682962 | 278564560 | 118412650 | ||
3754196 | 3754196 | 266534768 | 266561206 | 5309260 | ||
28499223 | 28499223 | 267320623 | 268835491 | 40303991 | ||
269060 | 269060 | 278436676 | 278436806 | 380874 | close to axis | |
19757528 | 19757528 | 276252593 | 276958219 | 27941369 | ||
1153155 | 17597694 | 284505475 | 285049196 | 284507812 | 17635444 | |
39855683 | 39855683 | 289009522 | 291744716 | 56364450 | ||
279344 | 279344 | 295580804 | 295580936 | 395426 | close to axis | |
2652884 | 2652884 | 296147744 | 296159626 | 3751784 | ||
5665682 | 9948611 | 299675971 | 299841062 | 299729524 | 11448804 | |
176701744 | 277988096 | 301426148 | 410042808 | 349401244 | 329394730 | |
4890947 | 4890947 | 310148338 | 310186900 | 6916866 | ||
87656304 | 304657300 | 326501460 | 446563852 | 338063354 | 317016874 | |
22521722 | 197659399 | 330082619 | 384738578 | 330850062 | 198938348 | |
88207391 | 88207391 | 335874338 | 347263754 | 124744090 | ||
181739248 | 181739248 | 340761092 | 386195904 | 257018110 | ||
16056991 | 16056991 | 343204322 | 343579734 | 22708022 | ||
112580 | 112580 | 352065796 | 352065814 | 160314 | closest to axis | |
47741680 | 47741680 | 358315556 | 361482096 | 67516934 | ||
360440 | 360440 | 360881449 | 360881629 | 510093 | ||
186528555 | 336694230 | 367945639 | 498745424 | 412525024 | 384910258 | |
133449304 | 263024289 | 389157144 | 469707419 | 411402479 | 294941509 | |
70740383 | 70740383 | 390950743 | 397299239 | 100042011 | ||
65911224 | 65911224 | 392721049 | 398213651 | 93212549 | ||
61506479 | 100295911 | 397206767 | 409673633 | 401940621 | 117653377 | |
3384479 | 3384479 | 401067842 | 401082122 | 4786418 | ||
88519204 | 404286960 | 404286960 | 571748102 | 413864224 | ||
49418435 | 49418435 | 418175726 | 421085644 | 69888224 | ||
228532 | 228532 | 421186288 | 421186350 | 323844 | close to axis | |
330790679 | 330790679 | 422520143 | 536605763 | 467808665 | ||
50785519 | 430183215 | 430183215 | 608370937 | 433170599 | ||
80617328 | 328786049 | 449290336 | 556742375 | 456465727 | 338525361 | |
247085696 | 247085696 | 453146417 | 516132751 | 349431943 | ||
75495296 | 185407204 | 458730368 | 494782156 | 464901162 | 200188340 | |
56043544 | 56043544 | 474236977 | 477537003 | 79257543 | ||
380024577 | 478552536 | 478552536 | 676775487 | 611090181 | ||
3569568 | 3569568 | 479802793 | 479816071 | 5048179 | ||
70792494 | 452957251 | 481066563 | 660753592 | 486247484 | 458455940 | |
23534848 | 23534848 | 517223273 | 517758441 | 33283309 | ||
8879775 | 8879775 | 546625150 | 546697270 | 12557920 | ||
27045233 | 564461264 | 564461264 | 798268775 | 565108807 | ||
130642831 | 130642831 | 581239103 | 595740249 | 184756865 | ||
gaps here: 580000000-590000000 reserved for inz | ||||||
gaps here: 590000000- not yet reserved |
All-round guru Robert Gerbiecz from the Mersenne Forum completely reorganised Inz' C code to utilise a small-prime sieve to filter out large swathes of impossible search space. It seems to provide a ~5x improvement over the original C (still being tested).
Inz converted the GP code into a multithreaded C program at something like 100x speedup, or something absurd like that. Compile it with:
gcc -Wall -Wextra -O3 -o sssms2 sssms2.c -lm -lpthread
Run it with the range start, range end, and optional number of threads.
Note - this is out of date code there's about a 3x speedup available
from just naive incremental improvements.
Here's a script that will search the range 1≤c≤b≤a≤5000. Those bounds being the first two numbers in the outermost 'for' command:
f2=[\ 19,1,0,0,17,0,0,0;\ 1,0,0,0,0,0,0,0;\ 0,0,0,136,0,0,0,136;\ 0,0,136,68,0,0,136,68;\ 17,0,0,0,17,0,0,0;\ 0,0,0,0,0,0,0,0;\ 0,0,0,136,0,0,0,136;\ 0,0,136,68,0,0,136,196\ ] for(a=1,5000,\ a8=a%8;\ for(b=1,a,\ b8=b%8;\ f3=f2[1+a8,1+b8];\ if(f3,\ a2b2=a*a+b*b;\ mrc=floor(sqrt(a2b2+b));\ for(rc=sqrtint(a2b2-1)+1,mrc,\ c=rc*rc-a2b2;\ if(bittest(f3,c%8)&&\ issquare(a*a+b+c*c)&&\ issquare(a+b*b+c*c),\ print(c" "b" "a)\ )\ )\ )\ )\ )
As one-line commands:
f2=[19,1,0,0,17,0,0,0;1,0,0,0,0,0,0,0;0,0,0,136,0,0,0,136;0,0,136,68,0,0,136,68;17,0,0,0,17,0,0,0;0,0,0,0,0,0,0,0;0,0,0,136,0,0,0,136;0,0,136,68,0,0,136,196] dorange(lo,hi)=for(a=lo,hi,a8=a%8;for(b=1,a,b8=b%8;f3=f2[1+a8,1+b8];if(f3,a2b2=a*a+b*b;mrc=floor(sqrt(a2b2+b));for(rc=sqrtint(a2b2-1)+1,mrc,c=rc*rc-a2b2;if(bittest(f3,c%8)&&issquare(a*a+b+c*c)&&issquare(a+b*b+c*c),print(c" "b" "a))))))
which, if saved as sssms.gp, can be invoked thus:
echo 'dorange(1,5000)' | gp sssms.gp
or even:
echo -e '#\ndorange(1,5000)' | gp sssms.gp
I ran with the '#' directive in GP before those lines to turn on timing, so I could have a comparison of how quickly different versions of the code ran on different boxes. With my little box (a 1.5GHz Celeron, yup, in 2021) the above 1-5000 took time = 13,949 ms. Bands of 10000 at higher ranges are starting to take many hours. There's an argument for either using C or some more mathematical smarts to solve this.
The 8×8 array is a set of bitmasks of valid residues mod 8 that the third variable can have given the residues mod 8 that the other 2 variables have. This is particularly useful as squares can only be 0,1,and 4 (mod 8), and to get the 3 sums to all be simultaniously from those valid values discards many b and c values. Only 36 of the 8×8×8=512 possibilities are permitted. It even throws away 1/8 of the a values - those 5 mod 8, hence the immediate rejection of such values in the C code. There's no need to immediately reject b==5 (mod 8) separately, that's part of the test on f2[a&7][b&7].
None implemented so far, but it appears not all (a,b,c) triplets mod 3 are admissible either (not surprising, -2 isn't a square mod 3 so you'd expect only (2/3)3=8/27 of the candidates to survive such a test:
$ perl -pe 's/(\d+)\s+(\d+)\s+(\d+).*/($1%3)."\t".($2%3)."\t".($3%3)/e' < squaresums.list | sort | uniq -c 18 0 0 0 42 0 0 1 9 0 1 0 20 1 0 0 17 1 1 1 19 1 1 2 2 1 2 1 8 1 2 2 6 2 1 1 5 2 1 2 18 2 2 1 43 2 2 2
So (000), (100)*, (111), (112)*, (122)*, and (222) are fine.
Therefore a==0 (mod 3) lets you reject b==2 (mod 3), and by symmetry, a==2 (mod 3) lets you reject b==0 (mod 3). a==1 (mod 3) brings no immediate gains.
Thanks to inz, boru, janrinok, and chromas from SoylentNews for letting me run the scripts/program on way bigger boxes than anything I have access to at home. And extra thanks to inz for converting the GP into C.