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.

A082470 a(n) is the number of k >= 0 such that k! + prime(n) is prime.

Original entry on oeis.org

2, 1, 3, 4, 5, 3, 6, 7, 6, 6, 9, 11, 9, 5, 10, 9, 10, 9, 9, 8, 9, 9, 11, 8, 10, 10, 12, 16, 12, 10, 10, 13, 14, 14, 16, 11, 12, 9, 15, 10, 9, 8, 12, 9, 10, 6, 8, 7, 14, 13, 10, 21, 15, 9, 13, 11, 9, 19, 12, 13, 16, 11, 19, 17, 9, 13
Offset: 1

Views

Author

Jeff Burch, Apr 27 2003

Keywords

Comments

k! + p is composite for k >= p since p divides k! for k >= p.
The first 10^6 terms are nonzero. Remarkably, the number 7426189 + m! is composite for all m <= 1793. - T. D. Noe, Mar 02 2010
Apparently it is not known whether a(n) is ever zero. - N. J. A. Sloane, Aug 11 2011

Examples

			For n = 4, 3!+7 = 13, 4!+7=31, 5!+7=127 and 6!+7 = 727 are the 4 primes in n!+7.
		

Crossrefs

Cf. A092789, A175193, A175194, row lengths of A352912.

Programs

  • Maple
    A082470 := proc(n)
        local ctr,j ;
        ctr := 0:
        for j from 0 to ithprime(n)-1 do
            if isprime(j!+ithprime(n))=true then
                ctr := ctr+1
            end if ;
        end do ;
        ctr
    end proc:
    seq(A082470(n),n=1..50) ;
  • Mathematica
    Table[Count[Range[0,Prime[n]-1]!+Prime[n],?PrimeQ],{n,70}] (* _Harvey P. Dale, Feb 06 2019 *)
  • PARI
    nfactppct(n) = { forprime(p=1,n, c=0; for(x=0,n,y=x!+p;if(isprime(y),c++) ); print1(c",") ) } \\ Cino Hilliard, Apr 15 2004
  • Python
    from sympy import isprime, prime
    from itertools import count, islice
    def agen(): # generator of terms
        for n in count(1):
            pn, fk, an = prime(n), 1, 0
            for k in range(1, pn+1):
                if isprime(pn + fk): an += 1
                fk *= k
            yield an
    print(list(islice(agen(), 40))) # Michael S. Branicky, Apr 16 2022
    

Extensions

Edited by Franklin T. Adams-Watters, Aug 01 2006
Offset corrected by Robert Israel, May 26 2021

A092789 a(n) = smallest prime of the form prime(n)+m! for some m >= 0.

Original entry on oeis.org

3, 5, 7, 13, 13, 19, 19, 43, 29, 31, 37, 43, 43, 67, 53, 59, 61, 67, 73, 73, 79, 103, 89, 113, 103, 103, 109, 109, 229, 137, 151, 137, 139, 163, 151, 157, 163, 283, 173, 179, 181, 363061, 193, 199, 199, 223, 331, 229, 229, 349, 239, 241, 5281, 257, 263, 269, 271
Offset: 1

Views

Author

Cino Hilliard, Apr 14 2004

Keywords

Comments

n! + p is composite for n >= p since p divides n! for n >= p.
Is it known that such a prime always exists? If not the definition should say "or -1 if no such prime exists". - N. J. A. Sloane, Aug 11 2011

Crossrefs

Programs

  • Magma
    SmallestP:=function(p) for m in [0..p-1] do q:=p+Factorial(m); if IsPrime(q) then return q; end if; end for; return -1; end function; [ SmallestP(NthPrime(n)): n in [1..80] ]; // Klaus Brockhaus, Mar 02 2010
  • Maple
    A092789 := proc(n) local q,m ; for m from 0 do q := ithprime(n)+m! ; if isprime(q) then return q; end if; end do ; end proc:
    seq(A092789(n),n=1..80) ; # R. J. Mathar, Mar 02 2010
  • PARI
    nfactpm3(n) = { forprime(p=1,n, c=0; for(x=0,n,y=x!+p;if(isprime(y),c++;print1(y",");break)); ) }
    

Extensions

Definition and offset corrected following a suggestion from Leroy Quet. - Klaus Brockhaus, Mar 02 2010

A175193 a(n) is the smallest positive integer such that (the n-th prime)+a(n)! is prime, or -1 if no such prime exists.

Original entry on oeis.org

1, 2, 2, 3, 2, 3, 2, 4, 3, 2, 3, 3, 2, 4, 3, 3, 2, 3, 3, 2, 3, 4, 3, 4, 3, 2, 3, 2, 5, 4, 4, 3, 2, 4, 2, 3, 3, 5, 3, 3, 2, 9, 2, 3, 2, 4, 5, 3, 2, 5, 3, 2, 7, 3, 3, 3, 2, 3, 3, 2, 4, 4, 3, 2, 4, 8, 3, 5, 2, 4, 3, 4, 3, 3, 5, 3, 5, 4, 5, 4, 2, 5, 2, 3, 4, 3, 5, 3, 2, 4, 4, 4, 5, 7, 4, 3, 6, 2, 4, 3, 4, 3, 3, 2, 3
Offset: 1

Views

Author

Leroy Quet, Mar 01 2010

Keywords

Comments

A175194(n) = a(n)!.

Examples

			From _Michael De Vlieger_, Nov 24 2017: (Start)
Records and their indices in a(n):
    i          n   a(n)
   --------------------
    1        1      1
    2        2      2
    3        4      3
    4        8      4
    5       29      5
    6       42      9
    7      233     10
    8      254     42
    9     4508     49
   10     7003    124
   11     7385    276
   12    60650    311
   13    97146    542
(End)
		

Crossrefs

Programs

  • Mathematica
    Fold[Append[#1, SelectFirst[Range[12], Function[k, PrimeQ[Prime[#2] + k!]]]] &, {1}, Range[2, 105]] (* Michael De Vlieger, Nov 24 2017 *)
  • PARI
    a(n) = {my(k = 1, p = prime(n)); while (!isprime(p + k!), k++); k;} \\ Michel Marcus, Nov 25 2017

Formula

A092789(n) = A000040(n) + a(n)!.

Extensions

Extended by Ray Chandler, Mar 04 2010
Showing 1-3 of 3 results.