%I #30 Jun 14 2018 17:57:38
%S 0,2,3,7,25,121,35,433,226,881,495,1,676,1233,2701,2049,4420,1,4009,1,
%T 2647,6425,4945,1,626,15393,1,1,13137,1,21731,1,13069,2041,1,1,23532,
%U 19153,50194,1,14104,1,41237,1,1,76729,86433,1,1,1,78031,1,77645
%N a(n) = (n-1)! + 1 mod n^3.
%C There is no known number n > 1 for which a(n)=0.
%C 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.
%C Obviously, when a(n) = 1, then also A055976(n) = 1 and A301316(n) = 1.
%C If n is prime, a(n) is divisible by n. - _Robert Israel_, Mar 20 2018
%H Stanislav Sykora, <a href="/A301317/b301317.txt">Table of n, a(n) for n = 1..10000</a>
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Wilson_prime">Wilson prime</a>
%F a(n) = ((n-1)! + 1) mod n^3. - _Jon E. Schoenfield_, Mar 18 2018
%F a(n) = A038507(n-1) mod A000578(n). - _Michel Marcus_, Mar 20 2018
%e From _Muniru A Asiru_, Mar 20 2018: (Start)
%e ((1-1)! + 1) mod 1^3 = (0! +1) mod 1 = 2 mod 1 = 0.
%e ((2-1)! + 1) mod 2^3 = (1! +1) mod 8 = 2 mod 8 = 2.
%e ((3-1)! + 1) mod 3^3 = (2! +1) mod 27 = 3 mod 27 = 3.
%e ((4-1)! + 1) mod 4^3 = (3! +1) mod 64 = 7 mod 64 = 7.
%e ((5-1)! + 1) mod 5^3 = (4! +1) mod 125 = 25 mod 125 = 25.
%e ... (End)
%p seq((factorial(n-1)+1) mod n^3,n=1..60); # _Muniru A Asiru_, Mar 20 2018
%t Array[Mod[(# - 1)! + 1, #^3] &, 53] (* _Michael De Vlieger_, Mar 19 2018 *)
%o (PARI) a(n) = ((n-1)! + 1) % n^3; \\ _Michel Marcus_, Mar 18 2018
%o (GAP) List([1..60],n->(Factorial(n-1)+1) mod n^3); # _Muniru A Asiru_, Mar 20 2018
%Y Cf. A000578, A038507, A055976, A301316.
%K nonn
%O 1,2
%A _Stanislav Sykora_, Mar 18 2018
|