Jacobi symbol: Difference between revisions
Content deleted Content added
m →{{header|REXX}}: simplified code, aligned some statements, added comments. |
m →{{header|REXX}}: simplified program. |
||
Line 241:
if cols='' | cols=="," then cols= 16 /* " " " " " " */
call hdrs /*display the (two) headers to the term*/
say _
end /*n*/▼
say translate(@.2, '╩╧╝', "╬╤╗") /*display the bottom of the grid border*/
exit /*stick a fork in it, we're all done. */
Line 257 ⟶ 254:
@.2= '════╬'; do c=0 to cols; @.2= @.2 || "════╤" ; end
L= length(@.2); @.2= left(@.2, L - 1)"╗" ; say @.2
!= '║' ; return
/*──────────────────────────────────────────────────────────────────────────────────────*/
jacobi: procedure; parse arg a,n; er= '***error***'; $ = 1
if n//2==0 then do; say er n " must be a positive odd integer."; exit 13
end
a= a // n
do while a\==0 /*perform while A isn't zero. */
if
parse value a n with
a= a //
▲ if n==1 then return result
return 0</lang>
{{out|output|text= when using the default inputs:}}
|