Primality by Wilson's theorem: Difference between revisions
Content added Content deleted
(Better explained there) |
No edit summary |
||
Line 7: | Line 7: | ||
Use [http://www.cut-the-knot.org/blue/Wilson.shtml Wilson's theorem.] |
Use [http://www.cut-the-knot.org/blue/Wilson.shtml Wilson's theorem.] |
||
A number is prime if p divides <code>(p - 1)! + 1</code>. |
Revision as of 04:41, 1 January 2020
Primality by Wilson's theorem
You are encouraged to solve this task according to the task description, using any language you may know.
You are encouraged to solve this task according to the task description, using any language you may know.
- Task
Write a boolean function that tells whether a given integer is prime.
Remember that 1 and all non-positive numbers are not prime.
A number is prime if p divides (p - 1)! + 1
.