Determine the possible nonzero units digits of a duodecimal positive integer n such that:
Each of n and n+2 is a prime number, and:
n+2 is expressible as the sum of squares of two positive itegers.
The following program finds that among the 12,792 such pairs through 6104927, 6104929=112225+5992704, the final duodecimal digit of n+2 is 1 except for the case where n+2 = 5, where obviously the only digit is 5.
This means that for n, the only values are 3 and B (the latter representing base-10 11), with there being only one instance of the 3, which is 3 itself.
Note that the program's N is the puzzle's n+2:
10 loop
20 Prev=N
30 N=nxtprm(N)
40 if N-Prev=2 then
50 :Good=0
60 :for I=1 to int(sqrt(N)/2)
70 :Sq1=I*I
80 :Sq2=N-Sq1
90 :Sr2=int(sqrt(Sq2)+0.5)
100 :if Sr2*Sr2=Sq2 then Good=1:cancel for:goto 120:endif
110 :next I
120 :if Good=1 then inc Ct:print N,N @ 12,Ct,Sq1;Sq2:endif
125 :if Good=1 and N @ 12<>1 and N>5 then stop:endif
130 :endif
140 endloop
|
Posted by Charlie
on 2011-09-22 15:21:02 |