login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo

Please make a donation to keep the OEIS running. We are now in our 56th year. In the past year we added 10000 new sequences and reached almost 9000 citations (which often say "discovered thanks to the OEIS").
Other ways to donate

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A301316 a(n) = ((n-1)! + 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, (n-1)! 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) = ((n-1)! + 1) mod n^2. - Jon E. Schoenfield, Mar 18 2018

a(n) = A038507(n-1) mod A000290(n). - Michel Marcus, Mar 20 2018

EXAMPLE

From Muniru A Asiru, Mar 20 2018: (Start)

((1-1)! + 1) mod 1^2 = (0! +1) mod 1 = 2 mod 1 = 0.

((2-1)! + 1) mod 2^2 = (1! +1) mod 4 = 2 mod 4 = 2.

((3-1)! + 1) mod 3^2 = (2! +1) mod 9 = 3 mod 9 = 3.

((4-1)! + 1) mod 4^2 = (3! +1) mod 16 = 7 mod 16 = 7.

((5-1)! + 1) mod 5^2 = (4! +1) mod 25 = 25 mod 25 = 0.

... (End)

MAPLE

seq((factorial(n-1)+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) = ((n-1)! + 1) % n^2; \\ Michel Marcus, Mar 18 2018

(GAP) List([1..60], n->(Factorial(n-1)+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

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified November 25 08:58 EST 2020. Contains 338623 sequences. (Running on oeis4.)