RosettaCodeData/Task/Primality-by-Wilsons-theorem/00-TASK.txt
2023-07-01 13:44:08 -04:00

14 lines
483 B
Text

;Task:
Write a boolean function that tells whether a given integer is prime using [http://www.cut-the-knot.org/blue/Wilson.shtml Wilson's theorem].
By Wilson's theorem, a number '''p''' is prime if and only if '''p''' divides <code>(p - 1)! + 1</code>.
Remember that '''1''' and all non-positive integers are not prime.
;See also:
* [http://www.cut-the-knot.org/blue/Wilson.shtml Cut-the-knot: Wilson's theorem.]
* [[wp:Wilson's_theorem|Wikipedia: Wilson's theorem]]
<br><br>