5 PrevSq=""
10 St=-int(-sqrt(10000))
20 Fin=int(sqrt(99999))
30 print St,Fin
40 for N=St to Fin
50 Sq=cutspc(str(N*N))
60 A=mid(Sq,1,2)
61 B=mid(Sq,3,2)
62 C=mid(Sq,5,1)
65 gosub *Test
70 A=mid(Sq,1,2)
71 B=mid(Sq,3,1)
72 C=mid(Sq,4,2)
75 gosub *Test
80 A=mid(Sq,1,1)
81 B=mid(Sq,2,2)
82 C=mid(Sq,4,2)
85 gosub *Test
200 next
300 end
400 *Test
405 Good=1
410 if left(A,1)="0" or left(B,1)="0" or left(C,1)="0" then Good=0
420 if A="1" or B="1" or C="1" then Good=0
430 if prmdiv(val(A))PrevSq then print:endif
470 :print Sq;:PrevSq=Sq
480 :print " ";A;" ";B;" ";C
500 return
finds
100 316
29241 29 2 41
31329 31 3 29
31329 3 13 29
53361 53 3 61
71289 71 2 89
72361 7 23 61
76729 7 67 29
78961 7 89 61
showing that the squares from 100^2 through 316^2 were checked--that is all the 5-digit squares.
Each line shows the square, and the three primes comprising it. The primes included in each square (other than the one that can be done in two ways) can be summarized, laid out left-to-right in order of the primes:
2 3 7 13 23 29 31 41 53 61 67 71 89
29241 x x x
53361 x x x
71289 x x x
72361 x x x
76729 x x x
78961 x x x
53361, 71289 and 76729 don't share any primes in common. The full list of those primes is 2, 3, 7, 29, 53, 61, 67, 71 and 89.
Based on Enigma No. 1604, "From primes to squares", by Richard England, New Scientist, 17 July 2010, page 24.
|