How to resolve the algorithm Primality by Wilson's theorem step by step in the Fōrmulæ programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Primality by Wilson's theorem step by step in the Fōrmulæ programming language

Table of Contents

Problem Statement

Write a boolean function that tells whether a given integer is prime using Wilson's theorem. By Wilson's theorem, a number p is prime if and only if p divides (p - 1)! + 1. Remember that 1 and all non-positive integers are not prime.

Let's start with the solution: