Третья ошибка в строке 210. Должно быть:
Код:
210 if R=1 and Allsquares=1 goto 380
Исправив все эти ошибки, мы видим, что вычеты, соответствующие

не все являются квадратичными, и в этом случае программа пропускает

.
Это неправильно, потому что так мы не получаем ни одного подходящего

.
Вместо этого, если какой-то из этих вычетов квадратичный, нужно проверять с ним.
-- Чт авг 18, 2016 17:23:56 --Исправленная программа:
Код:
10 N=5
30 open "PRIMEST.txt" for input as #1
40 for I=1 to 10000
50 input #1,P
60 P=val(P)
70 R=modpow(P,1,N)
80 if R<>1 goto 380
100 S5=0
110 for I1=2 to P-1
120 R=modpow(I1,N,P)
140 if R=1 then S5=I1
150 next I1
160 Allsquares=1
170 for I1=1 to 4
180 if fnNotsquare(1+S5^I1,P) then Allsquares=0
190 next I1
200 R=modpow(P,1,4)
210 if R=1 and Allsquares=1 goto 380
220 Allsquares=1
230 Therearesquares=0
250 for I1=1 to 4
260 S6=modpow(S5,I1,P)
270 Sqr=0
280 for I3=0 to P-1
290 if modpow(I3,2,P)=S6-1 then Sqr=I3
300 next I3
310 if Sqr=0 goto 340
320 F=(S6^3-Sqr)*(10*S6^4+5*S6^3+1-(S6-1)^2*Sqr)
330 if fnNotsquare(F,P) then Allsquares=0 else Therearesquares=1
340 next I1
360 if Allsquares=0 and Therearesquares=1 then print P,
370 ' print Allsquares,Therearesquares,P,S5
380 next I
390 close #1
400 end
410 fnNotsquare(V,P)
420 V=modpow(V,1,P)
430 Notsquare=1
440 for I2=0 to P-1
450 if modpow(I2,2,P)=V then Notsquare=0
460 next I2
470 return(Notsquare)
Программа по-прежнему не даёт ни одного подходящего

.
Если проверять выражение

, то программа даёт много подходящих

.