First I used UBASIC to save a list of prime numbers through 10,007. The following prigram reads that list and produces a file of all the formable numbers by using squares up to 71^2, assuring that each term up to at least 10,000 will be included, so as to make sure all formable numbers up to that value will be represented on the output list, which is then sorted so that any gaps can be found by the second phase. The odd primes themselves are included as the conjecture applies only to composite numbers not being missing.
OPEN "primelst.txt" FOR INPUT AS #1
OPEN "goldnums.txt" FOR OUTPUT AS #2
CLS
' looking up to 10,000
DO
INPUT #1, prm
FOR b = 0 TO 71 ' the zero puts the primes on the list
g = prm + 2 * b * b
IF g MOD 2 = 1 THEN
PRINT #2, USING "#####"; prm + 2 * b * b
END IF
NEXT b
LOOP UNTIL EOF(1)
CLOSE
SHELL "sort < goldnums.txt > gnums.txt"
'sorted list of odd formable numbers, including primes, as squares can be zero
OPEN "gnums.txt" FOR INPUT AS #1
DO
prevn = n
INPUT #1, n
IF prevn > 0 AND prevn + 2 < n THEN
PRINT prevn + 2
END IF
LOOP UNTIL EOF(1) OR n > 10000
CLOSE
The program finds two missing odd numbers under 10,000:
5777
5993

Posted by Charlie
on 20130205 15:47:15 