Primality by Wilson's theorem: Difference between revisions
Initial FutureBasic task solution added
(Initial FutureBasic task solution added) |
|||
Line 1,299:
53 59 61 67 71
73 79 83 89 97</pre>
=={{header|FutureBasic}}==
<syntaxhighlight lang="futurebasic">
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
</syntaxhighlight>
{{output}}
<pre>
2
3
5
7
11
13
17
19
23
29
31
37
41
43
47
53
59
61
67
71
73
79
83
89
97
</pre>
=={{header|Fōrmulæ}}==
|