OFFSET
1,2
COMMENTS
There is no known number n > 1 for which a(n)=0.
For a(n) to equal 1, (n-1)! must be divisible by n^3 which tends to be the most frequent case for large n. For example, all n which are a product of three or more distinct primes belong to this category. So do all proper powers of primes except 2^2, 2^3, 2^4, 3^2, and 5^2.
If n is prime, a(n) is divisible by n. - Robert Israel, Mar 20 2018
LINKS
Stanislav Sykora, Table of n, a(n) for n = 1..10000
Wikipedia, Wilson prime
FORMULA
a(n) = ((n-1)! + 1) mod n^3. - Jon E. Schoenfield, Mar 18 2018
EXAMPLE
From Muniru A Asiru, Mar 20 2018: (Start)
((1-1)! + 1) mod 1^3 = (0! +1) mod 1 = 2 mod 1 = 0.
((2-1)! + 1) mod 2^3 = (1! +1) mod 8 = 2 mod 8 = 2.
((3-1)! + 1) mod 3^3 = (2! +1) mod 27 = 3 mod 27 = 3.
((4-1)! + 1) mod 4^3 = (3! +1) mod 64 = 7 mod 64 = 7.
((5-1)! + 1) mod 5^3 = (4! +1) mod 125 = 25 mod 125 = 25.
... (End)
MAPLE
seq((factorial(n-1)+1) mod n^3, n=1..60); # Muniru A Asiru, Mar 20 2018
MATHEMATICA
Array[Mod[(# - 1)! + 1, #^3] &, 53] (* Michael De Vlieger, Mar 19 2018 *)
PROG
(PARI) a(n) = ((n-1)! + 1) % n^3; \\ Michel Marcus, Mar 18 2018
(GAP) List([1..60], n->(Factorial(n-1)+1) mod n^3); # Muniru A Asiru, Mar 20 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Stanislav Sykora, Mar 18 2018
STATUS
approved