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 23 results. Next

A339959 Number of times the n-th prime (=A000040(n)) occurs in A033932.

Original entry on oeis.org

0, 0, 1, 2, 2, 0, 1, 1, 2, 2, 3, 2, 1, 2, 1, 3, 1, 2, 3, 3, 1, 1, 2, 1, 5, 2, 1, 4, 1, 3, 4, 6, 1, 2, 3, 0, 1, 0, 1, 0, 0, 3, 2, 1, 1, 1, 0, 3, 4, 5, 1, 5, 5, 0, 3, 0, 0, 8, 1, 0, 5, 2, 3, 2, 1, 4, 5, 1, 1, 1, 2, 1, 2, 0, 2, 2, 3, 4, 3, 2, 0, 6, 1, 1, 4, 4
Offset: 1

Views

Author

A.H.M. Smeets, Dec 25 2020

Keywords

Comments

Each term in A033932 is either 1 or a prime number. Moreover, it is known that each prime occurs only a finite number of times in A033932.
By excluding the terms that equal one from A033932, we observe the smallest value of A033933(n)/log(n!) in the range n = 2..4000 to be ~0.1399. From this it is believed that the primes less than 0.9*log(4001!)*0.1399 (~ 3676) will not occur anymore in the sequence A033932 for n > 4000; the applied factor 0.9 is a safety factor to be more or less sure that the prime numbers up to about 3676 will no longer occur in A033932 for n > 4000.

Examples

			The prime number 11 occurs 2 times in A033932, and A000040(5) = 11, so a(5) = 2.
		

Crossrefs

Formula

It seems that Sum_{k = 1..n} a(k) ~ 0.7*A000040(n)/log(log(A000040(n))).

A033933 Least nonnegative m such that n! - m is prime.

Original entry on oeis.org

0, 1, 1, 7, 1, 1, 31, 13, 11, 13, 1, 23, 1, 47, 53, 59, 41, 101, 31, 31, 73, 89, 73, 149, 37, 43, 101, 31, 1, 61, 1, 1, 193, 113, 127, 97, 1, 73, 83, 131, 79, 109, 109, 53, 89, 79, 103, 59, 97, 179, 67, 59, 127, 61, 461, 277, 109, 137, 139, 71, 71, 101, 359, 127, 317, 191, 251, 103, 97, 751, 163, 373, 199, 167, 157, 491, 317
Offset: 2

Views

Author

Keywords

Comments

Conjecture: for n >= 3, a(n) is 1 or a prime. - Amarnath Murthy, Mar 19 2002
a(n) is not divisible by any prime <= n. If a(n) > 1 is composite, then a(n) > n^2. There are no entries up to n = 2000 with a(n) > n^2, and there may be none. - Robert Israel, Jul 20 2014

Crossrefs

Programs

  • Maple
    0, seq(n! - prevprime(n!), n=3..100); # Robert Israel, Jul 15 2014
  • Mathematica
    p[n_] := Module[{nf = n!}, nf - NextPrime[nf, -1]]; Join[{0}, Table[p[n], {n, 3, 70}]] (* Harvey P. Dale, Jul 07 2012 *)
  • PARI
    for(n=2,70, k=0; while(!isprime(n!-k), k++); print1(k,","))
    
  • PARI
    vector(66, t, my(n=t+1, f=n!); f-precprime(f)) \\ Joerg Arndt, Jul 19 2014
    
  • Sage
    def A033933(n):
        if n < 3: return 0
        f = factorial(n)
        return f - previous_prime(f)
    [A033933(n) for n in (2..78)] # Peter Luschny, Jul 20 2014

Extensions

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

A037153 a(n) = p-n!, where p is the smallest prime > n!+1.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Analogous to Fortunate numbers and like them, the entries appear to be primes. In fact, the first 1200 terms are primes. Are all terms prime?
a(n) is the first (smallest) m such that m > 1 and n!+ m is prime. The second such m is A087202(n). a(n) must be greater than nextprime(n)-1. - Farideh Firoozbakht, Sep 01 2003
Sequence A069941, which counts the primes between n! and n!+n^2, provides numerical evidence that the smallest prime p greater than n!+1 is a prime distance from n!; that is, p-n! is a prime number. For p-n! to be a composite number, p would have to be greater than n!+n^2, which would imply that A069941(n)=0. - T. D. Noe, Mar 06 2010
The first 4003 terms are prime. - Dana Jacobsen, May 10 2015

Crossrefs

Programs

  • Magma
    z:=125; [p-f where p is NextPrime(f+1) where f is Factorial(n): n in [1..z]]; // Klaus Brockhaus, Mar 02 2010
    
  • Mathematica
    NextPrime[ n_Integer ] := (k=n+1; While[ !PrimeQ[ k ], k++ ]; Return[ k ]); f[ n_Integer ] := (p = n! + 1; q = NextPrime[ p ]; Return[ q - p + 1 ]); Table[ f[ n ], {n, 1, 75} ] (* Robert G. Wilson v *)
  • MuPAD
    for n from 1 to 65 do f := n!:a := nextprime(f+2)-f:print(a) end_for; // Zerinvary Lajos, Feb 22 2007
    
  • PARI
    a(n)=nextprime(n!+2)-n! \\ Charles R Greathouse IV, Jul 02 2013; Corrected by Dana Jacobsen, May 10 2015
    
  • Perl
    use ntheory ":all"; for my $n (1..1000) { my $f=factorial($n); say "$n ",next_prime($f+1)-$f; } # Dana Jacobsen, May 10 2015
    
  • Python
    from sympy import factorial, nextprime
    def a(n): fn = factorial(n); return nextprime(fn+1) - fn
    print([a(n) for n in range(1, 66)]) # Michael S. Branicky, May 22 2022

Extensions

Edited by N. J. A. Sloane, Mar 06 2010

A037151 Smallest prime > n!.

Original entry on oeis.org

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

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    PrimeNext[n_]:=Module[{k},k=n+1;While[ !PrimeQ[k],k++ ];k]; Table[PrimeNext[n! ],{n,40}] (* Vladimir Joseph Stephan Orlovsky, May 30 2010 *)
    Table[NextPrime[n!],{n,25}] (* Harvey P. Dale, Dec 12 2010 *)
  • Python
    from sympy import factorial, nextprime
    def a(n): return nextprime(factorial(n))
    print([a(n) for n in range(1, 23)]) # Michael S. Branicky, May 22 2022

Formula

a(n) = A151800(A000142(n)) = A000142(n) + A033932(n).

Extensions

Extended by Ray Chandler, Mar 07 2010

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

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

Original entry on oeis.org

0, 1, 5, 7, 19, 19, 31, 17, 11, 17, 83, 67, 353, 227, 163, 59, 61, 113, 353, 31, 1447, 571, 389, 191, 337, 883, 101, 1823, 659, 709, 163, 1361, 439, 307, 1093, 1733, 2491, 1063, 1091, 1999, 1439, 109, 2753, 607, 2617, 269, 103, 2663, 337, 14447, 2221, 5471, 2887
Offset: 2

Views

Author

Zak Seidov, Sep 18 2002

Keywords

Comments

For n=3,5,10,21,171,190,348, n! is an interprime, the average of two consecutive primes, see A053709. In general n! may be average of several pairs of primes, in which case the minimal distance is in the sequence. See also n^n and n!! as average of two primes in A075468 and A075410.
According to Goldbach's conjecture, a(n) always exists with a(n) = A047160(n!). - Jens Kruse Andersen, Jul 30 2014

Examples

			a(4)=5 because 4!=24 and 19 and 25 are primes with smallest distance 5 from 4!.
		

Crossrefs

Programs

  • Mathematica
    smp[n_]:=Module[{m=1,nf=n!},While[!PrimeQ[nf+m]||!PrimeQ[nf-m],m=m+2];m]; Join[{0},Array[smp,60,3]] (* Harvey P. Dale, Apr 18 2014 *)
  • PARI
    a(n) = {my (m=0); until (ok, ok = isprime(n!-m) && isprime(n!+m); if (!ok, m++);); return (m);} \\ Michel Marcus, Apr 19 2013

Extensions

More terms from David Wasserman, Jan 17 2005

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
Showing 1-10 of 23 results. Next