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.

A075758 Smallest k such that n!+k!-1 is prime, or 0 if no such k exists.

Original entry on oeis.org

2, 1, 2, 3, 5, 4, 7, 4, 4, 6, 2, 8, 14, 8, 8, 4, 17, 7, 26, 7, 6, 12, 6, 14, 14, 16, 2, 27, 6, 33, 6, 36, 26, 7, 33, 18, 2, 18, 6, 36, 2, 18, 14, 20, 25, 14, 25, 0, 22, 24, 34, 16, 46, 61, 18, 7, 25, 38, 47, 47, 54, 79, 157, 97, 28, 23, 7, 137, 24, 46, 36, 25, 2, 214, 94, 40, 2, 96
Offset: 1

Views

Author

Jon Perry, Oct 08 2002

Keywords

Comments

It is possible to prove a(48)=0: since 67 divides 48!-1 and thus all 48!+k!-1 for k>=67 are composite, it is sufficient to test all k<67 which was done by Robert G. Wilson v. Likewise 113 divides 111!-1, 797 divides 128!-1, 137 divides 135!-1, 163 divides 161!-1 etc. and therefore a(111)=a(128)=a(135)=a(161)=0.
From the previous comments follows that a(n)=0 if there is no k smaller than the smallest prime factor of n!-1 such that n!+k!-1 is prime.

Examples

			4!=24, 1!=1 but 24+1-1=24 is not prime. 24+2!-1=25, not prime 24+3!-1=29, prime, so a[4]=3
		

Programs

  • Mathematica
    a = {}; Do[k = 1; While[ ! PrimeQ[n! + k! - 1], k++ ]; a = Append[a, k], {n, 1, 47}]
  • PARI
    for (a=1,100,c=0; for (b=1,200, if (isprime(a!+b!-1),c=b; break)); if (c>0,print1(c,","),print1("0,")))

Extensions

Edited by Ralf Stephan, Jun 01 2005