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-10 of 16 results. Next

A033932 Least positive m such that n! + m is prime.

Original entry on oeis.org

1, 1, 1, 1, 5, 7, 7, 11, 23, 17, 11, 1, 29, 67, 19, 43, 23, 31, 37, 89, 29, 31, 31, 97, 131, 41, 59, 1, 67, 223, 107, 127, 79, 37, 97, 61, 131, 1, 43, 97, 53, 1, 97, 71, 47, 239, 101, 233, 53, 83, 61, 271, 53, 71, 223, 71, 149, 107, 283, 293, 271, 769, 131, 271
Offset: 0

Views

Author

Keywords

Comments

Conjecture: No term is a composite number. a(n) is a prime > 3*prime(k), where k is such that prime(k) < n <= prime(k+1). - Amarnath Murthy, Apr 07 2004
Terms after n = 2000 in the b-file correspond to Fermat and Lucas PRP. - Phillip Poplin, Oct 12 2019

Crossrefs

Programs

  • Maple
    a:= n-> (f-> nextprime(f)-f)(n!):
    seq(a(n), n=0..70);  # Alois P. Heinz, Feb 22 2023
  • Mathematica
    a[n_] := (an = 1; While[ !PrimeQ[n! + an], an++]; an); Table[a[n], {n, 0, 63}] (* Jean-François Alcover, Dec 05 2012 *)
    NextPrime[#]-#&/@(Range[0,70]!) (* Harvey P. Dale, May 18 2014 *)
  • PARI
    for(n=0,70, k=1; while(!isprime(n!+k), k++); print1(k,","))
    
  • PARI
    a(n) = nextprime(n!+1) - n!; \\ Michel Marcus, Dec 25 2020
    
  • Python
    from sympy import factorial, nextprime
    def a(n): fn = factorial(n); return nextprime(fn) - fn
    print([a(n) for n in range(64)]) # Michael S. Branicky, May 22 2022

Formula

a(n) = A151800(n!) - n!. - Max Alekseyev, Jul 23 2014

Extensions

More terms from Jud McCranie
a(21) onwards from Wouter Meeussen
Better description from Rick L. Shepherd, Nov 06 2002

A053709 Prime balanced factorials: numbers k such that k! is the mean of its 2 closest primes.

Original entry on oeis.org

3, 5, 10, 21, 171, 190, 348, 1638, 3329
Offset: 1

Views

Author

Labos Elemer, Feb 10 2000

Keywords

Comments

Also, the integers k such that A033932(k) = A033933(k).
k! is an interprime, i.e., the average of two successive primes.
The difference between k! and any of its two closest primes must be 1 or exceed k. - Franklin T. Adams-Watters
Larger terms may involve probable primes. - Hans Havermann, Aug 14 2014

Examples

			For the 1st term, 3! is in the middle between its closest prime neighbors 5 and 7.
For the 2nd term, 5! is in the middle between its closest prime neighbors 113 and 127.
From _Jon E. Schoenfield_, Jan 14 2022: (Start)
In the table below, k = a(n), k! - d and k! + d are the two closest primes to k!, and d = A033932(k) = A033933(k) = A053711(n):
.
  n     k     d
  -  ----  ----
  1     3     1
  2     5     7
  3    10    11
  4    21    31
  5   171   397
  6   190   409
  7   348  1657
  8  1638  2131
  9  3329  7607
(End)
		

Crossrefs

Cf. A075409 (smallest m such that n!-m and n!+m are both primes).

Programs

  • Maple
    for n from 3 to 200 do j := n!-prevprime(n!): if not isprime(n!+j) then next fi: i := 1: while not isprime(n!+i) and (i<=j) do i := i+2 od: if i=j then print(n):fi:od:
  • Mathematica
    PrevPrim[n_] := Block[{k = n - 1}, While[ !PrimeQ[k], k-- ]; k]; NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k] Do[ a = n!; If[2a == PrevPrim[a] + NextPrim[a], Print[n]], {n, 3, 415}]

Extensions

a(5)-a(6) from Jud McCranie, Jul 04 2000
a(7) from Robert G. Wilson v, Sep 17 2002
a(8) from Donovan Johnson, Mar 23 2008
a(9) from Hans Havermann, Aug 14 2014

A053710 Prime-balanced factorials: factorials k! that are the mean of their 2 closest neighboring primes.

Original entry on oeis.org

6, 120, 3628800, 51090942171709440000
Offset: 1

Views

Author

Labos Elemer, Feb 10 2000

Keywords

Comments

Values of k are in A053709.
The next two terms are 171! and 190!. - Jud McCranie, Jul 04 2000

Examples

			For k = 21, k! = 51090942171709440000, d = 31, and the closest primes to 21! are q = 21! - 31 = 51090942171709439969, p = 21! + 31 = 51090942171709440031.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[25]!,NextPrime[#]-#==#-NextPrime[#,-1]&] (* Harvey P. Dale, May 08 2025 *)

Formula

k! = (p+q)/2; p = k! + d, q = k! - d, where p and q are the closest primes to k!.
a(n) = A053709(n)!.

Extensions

a(3) corrected by Sean A. Irvine, Jan 14 2022

A056752 Distance from n! to the nearest prime.

Original entry on oeis.org

1, 0, 1, 1, 7, 1, 1, 23, 13, 11, 1, 1, 23, 1, 43, 23, 31, 37, 89, 29, 31, 31, 89, 73, 41, 37, 1, 67, 31, 1, 61, 1, 1, 97, 61, 127, 1, 1, 73, 53, 1, 79, 71, 47, 53, 89, 79, 53, 59, 61, 179, 53, 59, 127, 61, 149, 107, 109, 137, 139, 71, 71, 101, 67, 127, 283, 73, 83, 103, 97
Offset: 1

Views

Author

Labos Elemer, Jan 19 2001

Keywords

Examples

			For both 1! and 2! the nearest prime neighbor is 2, with distances of 1 and 0, respectively. The nearest primes around 8! are 40289 and 40343 with distances of 31 and 23, so a(8)=23.
		

Crossrefs

Cf. A006990, A037151, A033932, A033933, A053714 (signed version with a different second term).

Programs

  • Maple
    with(numtheory): [seq(min(nextprime(i!)-i!,i!-prevprime(i!)),i=3..100)]; # a(1) and a(2) computed individually
  • Mathematica
    Table[Function[k, Min[k - #, NextPrime@ # - k] &@If[n == 1, 0, Prime@ PrimePi@ k]][n!], {n, 16}] (* Michael De Vlieger, Jul 15 2017 *)

A058054 Smallest prime > n! minus largest prime <= n!.

Original entry on oeis.org

1, 2, 6, 14, 8, 12, 54, 30, 22, 14, 30, 90, 20, 90, 76, 90, 78, 190, 60, 62, 104, 186, 204, 190, 96, 44, 168, 254, 108, 188, 80, 38, 290, 174, 258, 98, 44, 170, 136, 132, 176, 180, 156, 292, 190, 312, 156, 142, 158, 450, 120, 130, 350, 132, 610, 384, 392, 430
Offset: 2

Views

Author

Labos Elemer, Nov 20 2000

Keywords

Examples

			For n = 2, 3, 4, 5, A037151(n) = 3, 7, 29, 127 and A006990(n) = 2, 5, 23, 113. The differences are: 1, 2, 6, 14.
		

Crossrefs

Essentially the same as A054588.

Programs

  • Maple
    [seq(nextprime(i!)-prevprime(i!+1), i=2...100)];
  • Mathematica
    f[n_] := NextPrime[n!] - NextPrime[n!, -1]; Array[f, 70, 3] (* Robert G. Wilson v, Jul 23 2014 *)

Formula

a(n) = A037151(n) - A006990(n)
a(n) = A033932(n) + A033933(n)

Extensions

Edited by Hans Havermann, Jul 23 2014

A053711 Numbers d such that, for some k, the upper and lower primes closest to k! are k! + d and k! - d.

Original entry on oeis.org

1, 7, 11, 31, 397, 409, 1657, 2131, 7607
Offset: 1

Views

Author

Labos Elemer, Feb 10 2000

Keywords

Comments

This sequence lists d = nextprime(k!) - k! = prevprime(k!) - k! for k in A053709.

Examples

			For k = 10, k! = 3628800, d = 11, and the closest primes to 10! are q = 10! - 11 = 3628789 and p = 10! + 11 = 3628811. The differences d are listed here.
		

Crossrefs

Programs

  • Mathematica
    Reap[Do[If[SameQ @@ #, Sow@ First[#]] &@ Abs[# - NextPrime[#, {-1, 1}]] &[i!], {i, 200}]][[-1, -1]] (* Michael De Vlieger, Jan 14 2022 *)

Extensions

a(5)-a(8) from Donovan Johnson, Oct 12 2008
a(9) from Hans Havermann, Aug 15 2014

A053714 Smallest (in magnitude) nonzero number m such that n!+m is prime.

Original entry on oeis.org

1, 1, 1, -1, 7, -1, -1, 23, -13, 11, 1, -1, -23, -1, 43, 23, 31, 37, 89, 29, 31, 31, -89, -73, 41, -37, 1, 67, -31, -1, -61, -1, -1, 97, 61, -127, 1, -1, -73, 53, 1, -79, 71, 47, -53, -89, -79, 53, -59, 61, -179, 53, -59, -127, -61, 149, 107, -109, -137, -139, -71, -71, -101, 67, -127, 283, 73, 83, -103, -97, -751, 101
Offset: 1

Views

Author

Labos Elemer, Feb 10 2000

Keywords

Comments

a(n) is the defined, nonzero (thus excluding a(1) and a(2) of A033933) minimum of A033932(n) and A033933(n) multiplied by -1 if that minimum is not A033932(n). If n!+m and n!-m are equidistant primes (A053709), we have (arbitrarily) chosen positive m.

Examples

			For n=4, the possible m are -1 (24-1) and +5 (24+5). The former is closer to 4! so a(4) is -1.
For n=5, the possible m are -7 (120-7) and +7 (120+7). Being equidistant to 5!, a(5) is +7.
		

Crossrefs

Cf. A006990, A037151, A033932, A033933, A053709, A056752 (unsigned version with a different second term).

Extensions

Edited by Hans Havermann, Jul 23 2014

A087421 Smallest prime >= n!.

Original entry on oeis.org

2, 2, 2, 7, 29, 127, 727, 5051, 40343, 362897, 3628811, 39916801, 479001629, 6227020867, 87178291219, 1307674368043, 20922789888023, 355687428096031, 6402373705728037, 121645100408832089, 2432902008176640029, 51090942171709440031, 1124000727777607680031
Offset: 0

Views

Author

Mitch Cervinka (puritan(AT)planetkc.com), Oct 22 2003

Keywords

Comments

n! is prime only when n=2. When n>2, for n!+m to be prime, m must be relatively prime to all the numbers from 2 to n. In particular, if m is between 2 and n, then (n!+m) will be divisible by m. Thus a(n) must be either n!+1, or else larger than n!+n.

Examples

			a(0) = 2 since 0! = 1 and 2 is the smallest prime >= 1.
a(4) = 29 since 4! = 24 and 29 is the smallest prime >= 24.
		

Crossrefs

Programs

  • Mathematica
    NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; Table[ NextPrim[n! - 1], {n, 0, 20}] (* Robert G. Wilson v, Oct 25 2003 *)
    Join[{2,2,2},NextPrime[Range[3,25]!]]  (* Harvey P. Dale, Feb 23 2011 *)
  • PARI
    a(n)=nextprime(n!); \\ R. J. Cano, Apr 08 2018
    
  • Python
    from sympy import factorial, nextprime
    def a(n): return nextprime(factorial(n)-1)
    print([a(n) for n in range(23)]) # Michael S. Branicky, May 22 2022

Formula

a(n) = min { p[i] | p[i]>=n! }, where p[i] is the set of prime numbers.
a(n) = A007918(A000142(n)). - Michel Marcus, Apr 09 2018

Extensions

Edited, corrected and extended by Robert G. Wilson v and Ray Chandler, Oct 25 2003

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

A053712 Lower balancing primes to prime-balanced factorials.

Original entry on oeis.org

5, 113, 3628789, 51090942171709439969
Offset: 1

Views

Author

Labos Elemer, Feb 10 2000

Keywords

Comments

The next two terms are 171!-397 and 190!-409. - Jud McCranie, Jul 04 2000

Examples

			113 is balancing 5! = 120 from below, where 5! = 120 is a balanced factorial.
		

Crossrefs

Formula

a(n) = A053709(n)! - A053711(n) = A053710(n) - A053711(n). - Amiram Eldar, Mar 10 2025
Showing 1-10 of 16 results. Next