for positive integer n {\displaystyle n} , where ⌊ ⌋ {\displaystyle \lfloor \ \rfloor } is the floor function, which rounds down to the nearest integer. By Wilson's theorem, n + 1 {\displaystyle n+1} is prime if and only if n ! ≡ n ( mod n + 1 ) {\displaystyle n!\equiv n{\pmod {n+1}}} . Thus, when n + 1 {\displaystyle n+1} is prime, the first factor in the product becomes one, and the formula produces the prime number n + 1 {\displaystyle n+1} .