cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

Original entry on oeis.org

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
Offset: 1

Views

Author

Stanislav Sykora, Mar 18 2018

Keywords

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.

Examples

			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)
		

Crossrefs

Programs

  • GAP
    List([1..60],n->(Factorial(n-1)+1) mod n^2); # Muniru A Asiru, Mar 20 2018
  • 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 *)
  • PARI
    a(n) = ((n-1)! + 1) % n^2; \\ Michel Marcus, Mar 18 2018
    

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