RosettaCodeData/Task/Primality-by-Wilsons-theorem/FutureBasic/primality-by-wilsons-theore...

20 lines
309 B
Plaintext

local fn WilsonPrime( n as long ) as BOOL
long i, fct = 1
BOOL result
for i = 2 to n -1
fct = (fct * i) mod n
next i
if fct == n - 1 then exit fn = YES else exit fn = NO
end fn = result
long i
print "Primes below 100:"
for i = 2 to 100
if fn WilsonPrime(i) then print i
next
HandleEvents