RosettaCodeData/Task/Primality-by-Wilsons-theorem/BCPL/primality-by-wilsons-theorem.bcpl
2023-07-01 13:44:08 -04:00

13 lines
251 B
Text

get "libhdr"
let wilson(n) = valof
$( let f = n - 1
if n < 2 then resultis false
for i = n-2 to 2 by -1 do
f := f*i rem n
resultis (f+1) rem n = 0
$)
let start() be
for i = 1 to 100 if wilson(i) do
writef("%N*N", i)