Jump to content

Primality by Wilson's theorem: Difference between revisions

m
→‎{{header|Factor}}: use math.factorials
m (→‎{{header|F_Sharp|F#}}: add </lang> tag to separate F# and Factor entries again)
m (→‎{{header|Factor}}: use math.factorials)
Line 116:
 
=={{header|Factor}}==
{{works with|Factor|0.99 20192020-1008-0614}}
<lang factor>USING: formatting grouping io kernel lists lists.lazy math
math.factorials math.functions memoize prettyprint sequences ;
 
MEMO: factorial ( m -- n ) ! memoize factorial function
[ 1 ] [ [ 1 - factorial ] [ * ] bi ] if-zero ;
 
: wilson ( n -- ? ) [ 1 - factorial 1 + ] [ divisor? ] bi ;
1,827

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.