Trailing-Edge
-
PDP-10 Archives
-
decus_20tap1_198111
-
decus/20-0020/legend.num
There are 2 other files named legend.num in the archive. Click here to see a list.
100' NAME--LEGENDRE
110'
120' DESCRIPTION--EVALUATES THE LEGENDRE SYMBOL (A/P).
130'
140' SOURCE--UNKNOWN
150'
160' INSTRUCTIONS--ENTER PAIRS A,P AS DATA IN 400 AND FOLLOWING.
170'
180'
190' * * * * * MAIN PROGRAM * * * * * * * * * *
200'
210 PRINT " A", " P", "(A/P)"
220 PRINT
230 DEF FNM(Z) = Z - P*INT(Z/P)
240 READ A, P
250 IF P>0 THEN 270
260 GOTO 430
270 LET S = (P-1)/2
280 LET L = 1
290 LET Q = A
300 IF S = 0 THEN 360
310 IF S/2 = INT(S/2) THEN 330
320 LET L = FNM(L*Q)
330 LET Q = FNM(Q*Q)
340 LET S = INT(S/2)
350 GO TO 300
360 IF L = 1 THEN 380
370 LET L = -1
380 PRINT A,P,L
390 GOTO 240
400 DATA 3456,3607,1024,3803,97,101
410 REM DATA IN 420 IS PART OF PROGRAM.
420 DATA -1,-1
430 END