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

A090786 Least nonnegative integer k such that n! + n + k + 1 is prime.

Original entry on oeis.org

0, 0, 0, 1, 0, 1, 0, 3, 14, 7, 0, 5, 16, 53, 4, 27, 6, 13, 18, 69, 8, 9, 8, 73, 106, 15, 32, 19, 38, 193, 76, 95, 46, 3, 62, 25, 94, 273, 4, 57, 12, 19, 54, 27, 2, 193, 54, 185, 4, 33, 10, 219, 0, 17, 168, 15, 92, 49, 224, 233, 210, 707, 68, 207, 2, 127, 216, 5, 14, 61, 68, 785
Offset: 0

Views

Author

Frederick Magata (frederick.magata(AT)uni-muenster.de), Feb 09 2004

Keywords

Comments

The (n-1) consecutive numbers n!+2, ..., n!+n (for n >= 2) are not prime. This fact implies that there are arbitrarily large gaps in the distribution of the prime numbers. However, n!+n+1 need not be a prime number. Now a(n) measures, when the next prime number after n!+n appears. Thus a(n)=0 means that n!+n+1 is prime and so on. Obviously, a(n) is parity conserving for n >= 2. I.e., if n >= 2 then 2 divides n iff 2 divides a(n).
Conjectures: By definition a(n)+n!+1 is prime, but is a(n)+n+1=A037153(n) also a prime number for all n > 2? Is the growth of b(n) := Sum_{k=0..n} a(k) quadratic, that is, is b(n)=O(n^2)?

Examples

			a(5)=1 because 5!+5+1+1=127 is prime and 126 is not.
a(7)=3 because 7!+7+3+1=5051 is prime and 5048, 5049 and 5050 are not prime.
		

Crossrefs

Programs

  • Maple
    a := proc(n) option remember;local r,m,k: r := n!+n: k := 1: m := r+1: while (not isprime(m)) do k := k+1: while (not igcd(k,n)=1) do k := k+1: od: m := r+k: od: k-1; end;
    # alternatively:
    a := proc(n) option remember; nextprime(n!+n)-n!-n-1; end;
  • Mathematica
    lnik[n_]:=Module[{c=n!+n+1},If[PrimeQ[c],0,NextPrime[c]-c]]; Array[ lnik, 80,0] (* Harvey P. Dale, Apr 08 2019 *)
  • PARI
    a(n) = apply(x->(nextprime(x)-x), n!+n+1); \\ Michel Marcus, Mar 21 2018

A073443 Numbers k such that k! - k - 1 is prime.

Original entry on oeis.org

3, 4, 10, 12, 346
Offset: 1

Views

Author

Rick L. Shepherd, Jul 31 2002

Keywords

Comments

Clearly n <> 2 (mod 3). For n>3, n!-n, n!-n+1, ..., n!-3, n!-2 is a sequence of n-1 consecutive composite numbers. Additional terms are greater than 2000.
a(5) > 7500. - Michael S. Branicky, Mar 04 2021
a(5) > 24000. - Michael S. Branicky, Nov 13 2024

Crossrefs

Cf. A073444 (corresponding primes), A002982 (n!-1 is prime), A073308 (n!+n+1 is prime).

Programs

  • Mathematica
    Select[Range[3, 346], PrimeQ[#! - # - 1] &] (* Arkadiusz Wesolowski, Jan 04 2012 *)
  • PARI
    for(n=3,2000,if(isprime(n!-n-1),print1(n,",")))
    
  • Python
    from math import factorial
    from sympy import isprime
    def ok(n): return isprime(factorial(n) - n - 1)
    print([m for m in range(3, 500) if ok(m)]) # Michael S. Branicky, Mar 04 2021

Extensions

Offset corrected by Arkadiusz Wesolowski, Jan 04 2012

A340013 The prime gap, divided by two, which surrounds n!.

Original entry on oeis.org

1, 3, 7, 4, 6, 27, 15, 11, 7, 15, 45, 10, 45, 38, 45, 39, 95, 30, 31, 52, 93, 102, 95, 48, 22, 84, 127, 54, 94, 40, 19, 145, 87, 129, 49, 22, 85, 68, 66, 88, 90, 78, 146, 95, 156, 78, 71, 79, 225, 60, 65, 175, 66, 305, 192, 196, 215, 205, 420, 101, 186, 213, 160
Offset: 3

Views

Author

Robert G. Wilson v, Jan 09 2021

Keywords

Comments

A theorem states that between (n+1)! + 2 and (n+1)! + (n+1) inclusive, there are n consecutive composite integers, namely 2, 3, 4, ..., n, n+1.
Records: 1, 3, 7, 27, 45, 95, 102, 127, 145, 146, 156, 225, 305, 420, 804, 844, 1173, 1671, 1725, 1827, 2570, 2930, 3318, 5142, 5946, 6837, 7007, 8208, 10221, ..., .

Examples

			For a(1), there are no positive primes which surround 1!. Therefore a(1) is undefined.
For a(2), there are two contiguous primes {2, 3} with 2 being 2!. The prime gap is 1. However, the two primes do not surround 2!, so a(2) is undefined.
For a(3), the following set of numbers, {5, 6, 7}, with 3! being in the middle. The prime gap is 2; therefore, a(3) = 1.
For a(4), the following set of numbers, {23, 24, 25, 26, 27, 28, 29} with 4! in between the two primes 23 & 29. The prime gap is 6, so a(4) = 3.
		

Crossrefs

Programs

  • Maple
    a:= n-> (f-> (nextprime(f-1)-prevprime(f+1))/2)(n!):
    seq(a(n), n=3..70);  # Alois P. Heinz, Jan 09 2021
  • Mathematica
    a[n_] := (NextPrime[n!, 1] - NextPrime[n!, -1])/2; Array[a, 70, 3]
  • PARI
    a(n) = (nextprime(n!+1) - precprime(n!-1))/2; \\ Michel Marcus, Jan 11 2021
    
  • Python
    from sympy import factorial, nextprime, prevprime
    def A340013(n):
        f = factorial(n)
        return (nextprime(f)-prevprime(f))//2 # Chai Wah Wu, Jan 23 2021

Formula

a(n) = (A037151(n) - A006990(n))/2 = (A033932(n) + A033933(n))/2.
a(n) = A054588(n)/2 = A058054(n)/2. - Alois P. Heinz, Jan 09 2021

A073309 Primes of the form k! + k + 1.

Original entry on oeis.org

2, 3, 5, 29, 727, 3628811, 80658175170943878571660636856403766975289505440883277824000000000053
Offset: 1

Views

Author

Rick L. Shepherd, Jul 24 2002

Keywords

Comments

a(6) = 3628811 and a(7), a 68-digit number, have been certified prime with Primo.

Examples

			a(4) = 6! + 6 + 1 = 727, a prime, so 727 is in this sequence (6 = A073308(4)).
		

Crossrefs

Cf. A073308 (corresponding n), A100858.

Programs

  • Mathematica
    f[n_]:=n!+n+1; lst={};Do[p=f[n];If[PrimeQ[p],AppendTo[lst,p]],{n,0,2*5!}];lst (* Vladimir Joseph Stephan Orlovsky, Jul 02 2009 *)
  • PARI
    for(n=0,1960,p=n!+n+1; if(isprime(p),print1(p,",")))

Formula

a(n) = A073308(n)! + A073308(n) + 1.

A092791 Numbers k such that (k-1)! + k is prime.

Original entry on oeis.org

1, 2, 3, 5, 7, 11, 53, 6823, 30839
Offset: 1

Views

Author

Cino Hilliard, Apr 15 2004

Keywords

Comments

All terms beyond the first must be prime. [Charles R Greathouse IV, Apr 19 2013]
a(10) > 37000. - Giovanni Resta, May 04 2013

Crossrefs

Cf. A073308.

Programs

  • Mathematica
    Select[Range[80], PrimeQ[(# - 1)! + #] &] (* Jayanta Basu, Apr 19 2013 *)
  • PARI
    pm1factpp(n) = { forprime(p=1,n, c=0; y=(p-1)!+p;if(isprime(y),print1(p",")) ) }

Formula

a(n) = A073308(n) + 1. - Michael S. Branicky, May 06 2025

Extensions

a(8)-a(9) from Giovanni Resta, May 04 2013

A192367 Numbers k such that k! + 2*k + 1 is prime.

Original entry on oeis.org

0, 2, 3, 5, 6, 18, 44, 113, 2615, 16914
Offset: 1

Views

Author

Keywords

Comments

Some of the larger entries may only correspond to probable primes.
a(11) > 30000. - Michael S. Branicky, Apr 20 2025

Examples

			6! + 2*6 + 1 = 733 is prime, so 6 is in the sequence.
		

Crossrefs

Cf. A073308 (k!+k+1 is prime).

Programs

  • Magma
    [ n: n in [0..1000] | IsPrime(Factorial(n)+2*n+1) ]; // Klaus Brockhaus, Jul 02 2011
    
  • Maple
    select(p -> isprime(factorial(p) + 2*p + 1), [$0 .. 1000]) # Reza K Ghazi, Jul 11 2021
  • Mathematica
    Select[Range[0, 1000], PrimeQ[#! + 2*# + 1] &] (* Reza K Ghazi, Jul 11 2021 *)
  • PARI
    for(n=0,10^5,N=n!+2*n+1;if(ispseudoprime(N),print1(n,", ")));
    /* use isprime() for stricter checking */ /* Joerg Arndt, Jul 03 2011 */
    
  • Python
    from sympy import isprime
    factor = 1;
    for i in range(0, 10000):
        if i < 2:
            factor = 1
        else:
            factor = factor*i
        if isprime(factor + 2*i + 1):
            print(i, end=', ')
    
  • SageMath
    [p for p in range(1000) if is_prime(factorial(p)+2*p+1)] # Reza K Ghazi, Jul 11 2021

Extensions

0 added by Arkadiusz Wesolowski, Jun 29 2011
a(9) from Arkadiusz Wesolowski, Jul 02 2011
a(10) from Charles R Greathouse IV, Oct 14 2011

A365639 Numbers k such that k! + k^3 + 1 is prime.

Original entry on oeis.org

0, 1, 2, 4, 6, 16, 28, 42
Offset: 1

Views

Author

DarĂ­o Clavijo, Sep 14 2023

Keywords

Comments

If k is a term then k+1 is not composite (since k! + k^3 + 1 is divisible by k+1 for a composite k > 4). - Amiram Eldar, Sep 14 2023
Any further terms exceed 50000. - Lucas A. Brown, Mar 05 2024

Crossrefs

Programs

  • Mathematica
    Select[Range[0, 50], ! CompositeQ[# + 1] && PrimeQ[#! + #^3 + 1] &] (* Amiram Eldar, Sep 14 2023 *)
  • Python
    from sympy import isprime, factorial
    print([k for k in range(0, 43) if isprime((factorial(k)+ k**3 + 1))])
Showing 1-7 of 7 results.