

A301316


a(n) = ((n1)! + 1) mod n^2.


2



0, 2, 3, 7, 0, 13, 35, 49, 64, 81, 11, 1, 0, 57, 1, 1, 85, 1, 38, 1, 1, 133, 184, 1, 1, 521, 1, 1, 522, 1, 589, 1, 1, 885, 1, 1, 259, 381, 1, 1, 656, 1, 559, 1, 1, 553, 282, 1, 1, 1, 1, 1, 1802, 1, 1, 1, 1, 2553, 1593, 1, 3416, 993, 1, 1, 1, 1, 804
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


COMMENTS

By definition, when n > 1, a(n) = 0 then n is a Wilson prime (A007540).
For a(n) to equal 1, (n1)! must be divisible by n^2 which is the prevailing case for large n. For example, all n which are a product of more than two distinct primes belong to this category. So do all proper powers of primes except 2^2, 2^3, and 3^2. Obviously, when a(n) = 1, then also A055976(n) = 1.
The cases of a(n) > 1 include, for example, all primes other than Wilson's and all numbers of the form n=2*p, where p is a prime.


LINKS

Stanislav Sykora, Table of n, a(n) for n = 1..10000
Wikipedia, Wilson prime


FORMULA

a(n) = ((n1)! + 1) mod n^2.  Jon E. Schoenfield, Mar 18 2018
a(n) = A038507(n1) mod A000290(n).  Michel Marcus, Mar 20 2018


EXAMPLE

From Muniru A Asiru, Mar 20 2018: (Start)
((11)! + 1) mod 1^2 = (0! +1) mod 1 = 2 mod 1 = 0.
((21)! + 1) mod 2^2 = (1! +1) mod 4 = 2 mod 4 = 2.
((31)! + 1) mod 3^2 = (2! +1) mod 9 = 3 mod 9 = 3.
((41)! + 1) mod 4^2 = (3! +1) mod 16 = 7 mod 16 = 7.
((51)! + 1) mod 5^2 = (4! +1) mod 25 = 25 mod 25 = 0.
... (End)


MAPLE

seq((factorial(n1)+1) mod n^2, n=1..60); # Muniru A Asiru, Mar 20 2018


MATHEMATICA

Array[Mod[(#  1)! + 1, #^2] &, 67] (* Michael De Vlieger, Apr 21 2018 *)


PROG

(PARI) a(n) = ((n1)! + 1) % n^2; \\ Michel Marcus, Mar 18 2018
(GAP) List([1..60], n>(Factorial(n1)+1) mod n^2); # Muniru A Asiru, Mar 20 2018


CROSSREFS

Cf. A000290, A038507, A007540, A055976, A301317.
Sequence in context: A263501 A203143 A249523 * A023048 A083521 A104691
Adjacent sequences: A301313 A301314 A301315 * A301317 A301318 A301319


KEYWORD

nonn


AUTHOR

Stanislav Sykora, Mar 18 2018


STATUS

approved



