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-3 of 3 results.

A245723 a(n) = position of the first occurrence of n in A245714.

Original entry on oeis.org

1, 3, 7, 19, 109, 509, 241, 317, 181, 1471, 2503, 2491, 7151, 11779, 3361, 2927, 1733, 5881, 15893, 16943, 11639, 31897, 25939, 12011, 17123, 6283, 10369, 63949, 8471, 125261, 64579, 117541, 21859, 58879, 44711, 216829, 64081, 67159, 73273, 181931, 139709
Offset: 1

Views

Author

Vaclav Kotesovec, Jul 30 2014

Keywords

Comments

Least m > 0 such that m+n! is the smallest prime of form m+k!. - Jens Kruse Andersen, Jul 30 2014

Examples

			a(2) = 3 since 3+2! is the smallest prime of the form 3+k!, and 3 is the least such number. While 1+2! is also prime, there is a smaller prime 1+1! in that case so a(2) is not 1. - _Jens Kruse Andersen_, Jul 30 2014
		

Crossrefs

Cf. A245714.

Programs

  • Mathematica
    nmax=2000; Table[nn=1; k=0; While[k!=n && nnnn,k=0]; nn++]; If[nn==nmax,0,nn-1],{n,1,10}]
  • PARI
    a(n)=for(k=1,n,if(ispseudoprime(n+k!),return(k)))
    b(n)=for(k=1,10^6,if(a(k)==n,return(k)))
    n=1;while(n<150,print1(b(n),", ");n++) \\ Derek Orr, Jul 30 2014

A245716 Least number k > 0 such that n + k! and n - k! are both prime, or 0 if no such k exists.

Original entry on oeis.org

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

Views

Author

Derek Orr, Jul 30 2014

Keywords

Comments

For a(n) > 0, a(n)! < n for all n. Thus a(n) = 0 is definite.

Examples

			13 + 1! and 13 - 1! are not both prime.
13 + 2! and 13 - 2! are not both prime.
13 + 3! and 13 - 3! are both prime (19 and 7). Thus a(13) = 3.
		

Crossrefs

Programs

  • PARI
    a(n)=for(k=1,n,if(ispseudoprime(n-k!)&&ispseudoprime(n+k!),return(k)))
    vector(150,n,a(n))

A241423 Largest number k > 0 such that n + k! is prime, or 0 if no such k exists.

Original entry on oeis.org

1, 2, 1, 4, 1, 6, 0, 2, 1, 10, 1, 6, 0, 2, 1, 11, 1, 14, 0, 2, 1, 16, 0, 3, 0, 2, 1, 20, 1, 22, 0, 0, 0, 4, 1, 33, 0, 2, 1, 25, 1, 38, 0, 2, 1, 44, 0, 6, 0, 2, 1, 52, 0, 4, 0, 2, 1, 27, 1, 50, 0, 0, 0, 4, 1, 64, 0, 2, 1, 55, 1, 67, 0, 0, 0, 6, 1, 73, 0, 2, 1, 68, 0, 4, 0, 2, 1, 52, 0, 6
Offset: 2

Views

Author

Derek Orr, Aug 08 2014

Keywords

Comments

If k >= n, then n + k! is divisible by n and is not prime.
a(n) < A020639(n), because if prime p divides n then p divides n + k! for k >= p. - Robert Israel, Aug 10 2014
There is no term for n = 1 since factorial primes 1 + k! can probably be arbitrarily large (A002981 shows k values). - Jens Kruse Andersen, Aug 13 2014

Crossrefs

Programs

  • Maple
    a:= proc(n)
    local k;
    for k from min(numtheory:-factorset(n)) to 1 by -1 do
      if isprime(n+k!)  then return(k) fi
    od:
    0
    end proc:
    seq(a(n),n=2..100); # Robert Israel, Aug 10 2014
  • Mathematica
    a[n_] := Module[{k}, For[k = FactorInteger[n][[1, 1]], k >= 1, k--, If[PrimeQ[n + k!], Return[k]]]; 0];
    a /@ Range[2, 100] (* Jean-François Alcover, Jul 27 2020, after Maple *)
  • PARI
    a(n)=forstep(k=n,1,-1,if(ispseudoprime(n+k!),return(k)))
    n=2;while(n<150,print1(a(n),", ");n++)
Showing 1-3 of 3 results.