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.

Showing 1-5 of 5 results.

A061007 a(n) = -(n-1)! mod n.

Original entry on oeis.org

0, 1, 1, 2, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0
Offset: 1

Views

Author

Henry Bottomley, Apr 12 2001

Keywords

Comments

The following sequences all appear to have the same parity (with an extra zero term at the start of A010051): A010051, A061007, A035026, A069754, A071574. - Jeremy Gardiner, Aug 09 2002
In particular, this is identical to the isprime function A010051 except for a(4) = 2 instead of 0. This is equivalent to Wilson's theorem, (n-1)! == -1 (mod n) iff n is prime. If n = p*q with p, q > 1, then p, q < n-1 and (n-1)! will contain the two factors p and q, unless p = q = 2 (if p = q > 2 then also 2p < n-1, so there are indeed two factors p in (n-1)!), whence (n-1)! == 0 (mod n). - M. F. Hasler, Jul 19 2024

Examples

			a(4) = 2 since -(4 - 1)! = -6 = 2 mod 4.
a(5) = 1 since -(5 - 1)! = -24 = 1 mod 5.
a(6) = 0 since -(6 - 1)! = -120 = 0 mod 6.
		

Crossrefs

Positive for all but the first term of A046022.
Cf. A000040 (the primes), A000142, A010051 (isprime function), A055976, A061006, A061008, A061009.

Programs

Formula

a(4) = 2, a(p) = 1 for p prime, a(n) = 0 otherwise. Apart from n = 4, a(n) = A010051(n) = A061006(n)/(n-1).

A093521 Runs of 1's of lengths 1, prime(1), prime(2), prime(3), ... separated by 0's.

Original entry on oeis.org

1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0
Offset: 1

Views

Author

Robert G. Wilson v, Mar 29 2004

Keywords

Comments

Carl Sagan's "Contact" sequence.
Zeros occur at positions given by 1+A110895(k). - Antti Karttunen, Nov 08 2018

References

  • W. A. Dembski and J. M. Kushiner, Signs of Intelligence, Baker Book House Co., Grand Rapids, MI, p30-31, 2001,
  • Carl Sagan, Contact, Simon and Schuster, Chapter 4 "Prime Numbers," pp. 68-82, NY, 1985.

Crossrefs

Programs

  • Mathematica
    a = Table[1, {100}]; Do[ a[[Sum[Prime[i], {i, n}] + n]] = 0, {n, 1, 8}]; a
  • PARI
    up_to = 111;
    A093521list(up_to) = { my(v=vector(up_to), i=2, j); v[1] = 1; v[2] = 0; forprime(p=2, oo, j=p; while(j, if(i==up_to, return(v), i++; v[i] = 1; j--)); if(i==up_to, return(v), i++; v[i] = 0)); };
    v093521 = A093521list(up_to);
    A093521(n) = v093521[n];

Extensions

Data section extended up to n=111 by Antti Karttunen, Nov 08 2018

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

A301317 a(n) = (n-1)! + 1 mod n^3.

Original entry on oeis.org

0, 2, 3, 7, 25, 121, 35, 433, 226, 881, 495, 1, 676, 1233, 2701, 2049, 4420, 1, 4009, 1, 2647, 6425, 4945, 1, 626, 15393, 1, 1, 13137, 1, 21731, 1, 13069, 2041, 1, 1, 23532, 19153, 50194, 1, 14104, 1, 41237, 1, 1, 76729, 86433, 1, 1, 1, 78031, 1, 77645
Offset: 1

Views

Author

Stanislav Sykora, Mar 18 2018

Keywords

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.
Obviously, when a(n) = 1, then also A055976(n) = 1 and A301316(n) = 1.
If n is prime, a(n) is divisible by n. - Robert Israel, Mar 20 2018

Examples

			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)
		

Crossrefs

Programs

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

Formula

a(n) = ((n-1)! + 1) mod n^3. - Jon E. Schoenfield, Mar 18 2018
a(n) = A038507(n-1) mod A000578(n). - Michel Marcus, Mar 20 2018

A249355 Remainder of n!+2 divided by n+2.

Original entry on oeis.org

1, 0, 0, 3, 2, 3, 2, 2, 2, 3, 2, 3, 2, 2, 2, 3, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 3, 2, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 3, 2, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 3, 2, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 2, 2, 2, 2, 3, 2, 2
Offset: 0

Views

Author

M. F. Hasler, Oct 26 2014

Keywords

Crossrefs

Programs

  • Magma
    [(Factorial(n)+2) mod(n+2): n in [0..100]]; // Vincenzo Librandi, Oct 27 2014
  • Mathematica
    Table[Mod[n!+2,n+2],{n,0,100}] (* Harvey P. Dale, Sep 01 2022 *)
  • PARI
    a(n)=lift(prod(k=2,n,k,Mod(1,n+2))+2)
    
  • PARI
    A249355(n)=if(n>2,isprime(n+2)+2,!n) \\ M. F. Hasler, Oct 31 2014
    

Formula

If n+2 = p > 4 is prime, then a(n) = 3. Indeed, it is known that (p-2)! = 1 (mod p) for all primes p. Thus n!+2 = 1+2 = 3 (mod n+2).
If n+2 is composite and n > 2 then a(n) = 2. There are two cases: n+2 = a*b with a < b <= n (so n! is divisible by a*b), or n+2 = a^2 with 2*a <= n (so n! is divisible by a*(2*a)). - Robert Israel, Oct 27 2014
Showing 1-5 of 5 results.