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

A241425 Largest 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, 4, 0, 4, 0, 2, 0, 0, 1, 4, 0, 2, 0, 4, 0, 0, 0, 0, 0, 3, 0, 4, 0, 0, 0, 0, 1, 0, 0, 0, 0, 4, 0, 3, 0, 2, 0, 0, 1, 3, 0, 0, 0, 4, 0, 0, 0, 2, 0, 4, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3
Offset: 1

Views

Author

Derek Orr, Aug 08 2014

Keywords

Comments

If k > n, n - k! is surely negative and, therefore, not prime.
a(n) < A020639(n). - Robert Israel, Aug 10 2014

Crossrefs

Programs

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

A242040 Numbers n such that n + k! and n - k! are both prime for some k.

Original entry on oeis.org

4, 5, 6, 9, 11, 12, 13, 15, 17, 18, 21, 23, 25, 29, 30, 35, 37, 39, 42, 43, 45, 47, 53, 55, 60, 65, 67, 69, 72, 73, 77, 81, 83, 85, 95, 99, 102, 103, 105, 107, 108, 111, 113, 125, 127, 129, 131, 133, 137, 138, 143, 145, 149, 150, 151, 155, 157, 161, 163, 165, 173, 175, 180, 185, 187
Offset: 1

Views

Author

Derek Orr, Aug 12 2014

Keywords

Comments

Subsequence of the complement of (A239321 union A125163).

Examples

			5 + 2! = 7 and 5 - 2! = 3 are both prime. Thus 5 is a member of this sequence.
		

Crossrefs

Programs

  • PARI
    a(n)=for(k=1,n,if(ispseudoprime(n+k!)&&ispseudoprime(n-k!),return(k)))
    n=1;while(n<500,if(a(n),print1(n,", "));n++)
Showing 1-2 of 2 results.