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

A340007 Number of times the n-th prime (=A000040(n)) occurs in A038711.

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 3, 0, 1, 0, 1, 0, 1, 0, 1, 2, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 2, 0, 1, 2, 0, 2, 0, 1, 2, 2, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 2, 0, 4, 0, 0, 0, 1, 0, 0, 1, 1, 2, 0, 1, 1, 0, 1, 2, 0, 0, 2, 1
Offset: 1

Views

Author

A.H.M. Smeets, Dec 26 2020

Keywords

Comments

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

Examples

			The prime number 17 occurs 1 time in A038711, and A000040(7) = 17, so a(7) = 1.
The prime number 5 does not occur in A038711, and A000040(3) = 5, so a(3) = 0.
		

Crossrefs

Formula

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

A005235 Fortunate numbers: least m > 1 such that m + prime(n)# is prime, where p# denotes the product of all primes <= p.

Original entry on oeis.org

3, 5, 7, 13, 23, 17, 19, 23, 37, 61, 67, 61, 71, 47, 107, 59, 61, 109, 89, 103, 79, 151, 197, 101, 103, 233, 223, 127, 223, 191, 163, 229, 643, 239, 157, 167, 439, 239, 199, 191, 199, 383, 233, 751, 313, 773, 607, 313, 383, 293, 443, 331, 283, 277, 271, 401, 307, 331
Offset: 1

Views

Author

Keywords

Comments

Reo F. Fortune conjectured that a(n) is always prime.
You might be searching for Fortunate Primes, which is an alternative name for this sequence. It is not the official name yet, because it is possible, although unlikely, that not all the terms are primes. - N. J. A. Sloane, Sep 30 2020
The first 500 terms are primes. - Robert G. Wilson v. The first 2000 terms are primes. - Joerg Arndt, Apr 15 2013
The strong form of Cramér's conjecture implies that a(n) is a prime for n > 1618, as previously noted by Golomb. - Charles R Greathouse IV, Jul 05 2011
a(n) is the smallest m such that m > 1 and A002110(n) + m is prime. For every n, a(n) must be greater than prime(n+1) - 1. - Farideh Firoozbakht, Aug 20 2003
If a(n) < prime(n+1)^2 then a(n) is prime. According to Cramér's conjecture a(n) = O(prime(n)^2). - Thomas Ordowski, Apr 09 2013
Conjectures from Pierre CAMI, Sep 08 2017: (Start)
If all terms are prime, then lim_{N->oo} (Sum_{n=1..N} primepi(a(n))) / (Sum_{n=1..N} n) = 3/2, and primepi(a(n))/n < 6 for all n.
Limit_{N->oo} (Sum_{n=1..N} a(n)) / (Sum_{n=1..N} prime(n)) = Pi/2.
a(n)/prime(n) < 8 for all n. (End)
Conjecture: Limit_{N->oo} (Sum_{n=1..N} a(n)) / (Sum_{n=1..N} prime(n)) = 3/2. - Alain Rocchelli, Dec 24 2022
The name "Fortunate numbers" was coined by Golomb (1981) after the New Zealand social anthropologist Reo Franklin Fortune (1903 - 1979). According to Golomb, Fortune's conjecture first appeared in print in Martin Gardner's Mathematical Games column in 1980. - Amiram Eldar, Aug 25 2020

Examples

			a(4) = 13 because P_4# = 2*3*5*7 = 210, plus one is 211, the next prime is 223 and the difference between 210 and 223 is 13.
		

References

  • Martin Gardner, The Last Recreations, Chapter 12: Strong Laws of Small Primes, Springer-Verlag, 1997, pp. 191-205, especially pp. 194-195.
  • Richard K. Guy, Unsolved Problems in Number Theory, 3rd ed., Springer, 1994, Section A2, p. 11.
  • Stephen P. Richards, A Number For Your Thoughts, 1982, p. 200.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, pages 114-115.
  • David Wells, Prime Numbers: The Most Mysterious Figures In Math, Hoboken, New Jersey: John Wiley & Sons (2005), pp. 108-109.

Crossrefs

Programs

  • Haskell
    a005235 n = head [m | m <- [3, 5 ..], a010051'' (a002110 n + m) == 1]
    -- Reinhard Zumkeller, Apr 02 2014
    
  • Maple
    Primorial:= 2:
    p:= 2:
    A[1]:= 3:
    for n from 2 to 100 do
      p:= nextprime(p);
      Primorial:= Primorial * p;
      A[n]:= nextprime(Primorial+p+1)-Primorial;
    od:
    seq(A[n],n=1..100); # Robert Israel, Dec 02 2015
  • Mathematica
    NPrime[n_Integer] := Module[{k}, k = n + 1; While[! PrimeQ[k], k++]; k]; Fortunate[n_Integer] := Module[{p, q}, p = Product[Prime[i], {i, 1, n}] + 1; q = NPrime[p]; q - p + 1]; Table[Fortunate[n], {n, 60}]
    r[n_] := (For[m = (Prime[n + 1] + 1)/2, ! PrimeQ[Product[Prime[k], {k, n}] + 2 m - 1], m++]; 2 m - 1); Table[r[n], {n, 60}]
    FN[n_] := Times @@ Prime[Range[n]]; Table[NextPrime[FN[k] + 1] - FN[k], {k, 60}] (* Jayanta Basu, Apr 24 2013 *)
    NextPrime[#]-#+1&/@(Rest[FoldList[Times,1,Prime[Range[60]]]]+1) (* Harvey P. Dale, Dec 15 2013 *)
  • PARI
    a(n)=my(P=prod(k=1,n,prime(k)));nextprime(P+2)-P \\ Charles R Greathouse IV, Jul 15 2011; corrected by Jean-Marc Rebert, Jul 28 2015
    
  • Python
    from sympy import nextprime, primorial
    def a(n): psharp = primorial(n); return nextprime(psharp+1) - psharp
    print([a(n) for n in range(1, 59)]) # Michael S. Branicky, Jan 15 2022
  • Sage
    def P(n): return prod(nth_prime(k) for k in range(1, n + 1))
    it = (P(n) for n in range(1, 31))
    print([next_prime(Pn + 2) - Pn for Pn in it]) # F. Chapoton, Apr 28 2020
    

Formula

If x(n) = 1 + Product_{i=1..n} prime(i), q(n) = least prime > x(n), then a(n) = q(n) - x(n) + 1.
a(n) = 1 + the difference between the n-th primorial plus one and the next prime.
a(n) = A035345(n) - A002110(n). - Jonathan Sondow, Dec 02 2015

A038710 a(n) is the smallest prime > product of the first n primes (A002110(n)).

Original entry on oeis.org

2, 3, 7, 31, 211, 2311, 30047, 510529, 9699713, 223092907, 6469693291, 200560490131, 7420738134871, 304250263527281, 13082761331670077, 614889782588491517, 32589158477190044789, 1922760350154212639131, 117288381359406970983379, 7858321551080267055879179
Offset: 0

Views

Author

Labos Elemer, May 02 2000

Keywords

Examples

			for n=1,2,3,4,5,11,75, A002110(n)+1 gives smaller primes than A002110(n)+p, where p is a fortunate number (prime). At n=5, both 2311 and 2333 are primes but the first is smaller.
		

Crossrefs

Programs

  • Maple
    p:= proc(n) option remember; `if`(n<1, 1, p(n-1)*ithprime(n)) end:
    a:= n-> nextprime(p(n)):
    seq(a(n), n=0..20);  # Alois P. Heinz, Mar 16 2020
  • Mathematica
    nmax = 2^16384; npd = 1; n = 1; npd = npd*Prime[n]; While[npd < nmax, cp = npd + 1; While[ ! (PrimeQ[cp]), cp = cp + 2]; Print[cp]; n = n + 1; npd = npd*Prime[n]] (* Lei Zhou, Feb 15 2005 *)
    NextPrime/@FoldList[Times,1,Prime[Range[25]]] (* Harvey P. Dale, Dec 17 2010 *)
  • PARI
    a(n) = nextprime(1+factorback(primes(n))); \\ Michel Marcus, Sep 25 2016; Dec 24 2022
    
  • Python
    from sympy import nextprime, primorial
    def a(n): return nextprime(primorial(n) if n else 1)
    print([a(n) for n in range(20)]) # Michael S. Branicky, Dec 24 2022

Formula

a(n) = A002110(n) + A038711(n). - Alois P. Heinz, Mar 16 2020

Extensions

Offset corrected, incorrect comment and formula removed, and more terms added by Jinyuan Wang, Mar 16 2020

A060270 Distance of n-th primorial from previous prime.

Original entry on oeis.org

1, 1, 11, 1, 1, 29, 23, 43, 41, 73, 59, 1, 89, 67, 73, 107, 89, 101, 127, 97, 83, 89, 1, 251, 131, 113, 151, 263, 251, 223, 179, 389, 281, 151, 197, 173, 239, 233, 191, 223, 223, 293, 593, 293, 457, 227, 311, 373, 257, 307, 313, 607, 347, 317, 307, 677, 467, 317
Offset: 2

Views

Author

Labos Elemer, Mar 23 2001

Keywords

Examples

			Before 7th primorial 510481 is the largest prime. Its distance from 510510 is a(7)=29.
		

Crossrefs

Programs

  • Maple
    [seq(product(ithprime(j),j=1..n)-prevprime(product(ithprime(j),j=1..n)), n=2..50)];
  • Mathematica
    Map[# - NextPrime[#, -1] &, Rest@ FoldList[Times, Prime@ Range[59]]] (* Michael De Vlieger, Aug 10 2023 *)
  • PARI
    a(n) = my(P=vecprod(primes(n))); P-precprime(P-1); \\ Michel Marcus, Aug 11 2023

Formula

a(n)=1 for n=2, 3, 5, 6, 13, 24, 66, 68, 167, ... (A057704); a(n)=A055211(n) otherwise. - Jeppe Stig Nielsen, Oct 31 2003

Extensions

More terms from Jeppe Stig Nielsen, Oct 31 2003

A340006 Number of times the n-th prime (=A000040(n)) occurs in A060270.

Original entry on oeis.org

0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 2, 0, 1, 3, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 3, 1, 0, 1, 1, 0, 2, 1, 1, 0, 0, 0, 1, 0, 2, 2, 1, 1, 2, 1, 0, 1, 0, 0, 0, 0, 2, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 2
Offset: 1

Views

Author

A.H.M. Smeets, Dec 26 2020

Keywords

Comments

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

Examples

			The prime number 7 does not occur in A060270, and A000040(4) = 7, so a(4) = 0.
The prime number 11 occurs 1 time in A060270, and A000040(5) = 11, so a(5) = 1.
		

Crossrefs

Formula

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

A060269 Distance of n-th primorial from closest prime.

Original entry on oeis.org

1, 1, 1, 1, 19, 23, 37, 41, 1, 59, 1, 47, 67, 59, 61, 89, 89, 103, 79, 83, 89, 1, 103, 131, 113, 127, 223, 191, 163, 179, 389, 239, 151, 167, 173, 239, 199, 191, 199, 223, 233, 593, 293, 457, 227, 311, 373, 257
Offset: 3

Views

Author

Labos Elemer, Mar 23 2001

Keywords

Examples

			7th primorial is surrounded by {510529,510481} primes in {19,71} distances of which the smaller is 19=a(7).
		

Crossrefs

Programs

  • Maple
    with(numtheory): [seq(min(nextprime(product(ithprime(j),j=1..n))-product(ithprime(j),j= >1..n),product(ithprime(j),j=1..n)-prevprime(product(ithprime(j),j=1..n >))), n=3..50)];
  • Mathematica
    dnp[n_]:=Module[{a=NextPrime[n,-1],b=NextPrime[n]},Min[n-a,b-n]]; dnp/@ FoldList[Times,Prime[Range[50]]] (* Harvey P. Dale, Jul 11 2017 *)

A350460 Positive integers k such that if p is the next prime > k then p - k is prime.

Original entry on oeis.org

3, 5, 8, 9, 11, 14, 15, 17, 20, 21, 24, 26, 27, 29, 32, 34, 35, 38, 39, 41, 44, 45, 48, 50, 51, 54, 56, 57, 59, 62, 64, 65, 68, 69, 71, 74, 76, 77, 80, 81, 84, 86, 87, 90, 92, 94, 95, 98, 99, 101, 104, 105, 107, 110, 111, 114, 116, 120, 122, 124, 125, 128, 129
Offset: 1

Views

Author

Ryan Bresler, Jan 01 2022

Keywords

Comments

a(n) is only prime when n is the lesser of a twin prime pair (A001359). All other terms are composite.

Examples

			3 is a term because the next prime > 3 is 5, and 5 - 3 = 2, which is prime.
14 is a term because the next prime > 14 is 17, and 17 - 14 = 3, which is prime.
		

Crossrefs

Programs

  • Mathematica
    Select[Range[130], PrimeQ[NextPrime[#] - #] &] (* Amiram Eldar, Jan 01 2022 *)
  • PARI
    isok(k) = my(p=nextprime(k+1)); isprime(p-k); \\ Michel Marcus, Jan 01 2022
  • Python
    from sympy import isprime, nextprime
    def ok(n): return n > 0 and isprime(nextprime(n) - n)
    print([k for k in range(130) if ok(k)]) # Michael S. Branicky, Jan 01 2022
    

A268480 Integers k such that A002110(k) is the average of two consecutive primes.

Original entry on oeis.org

2, 3, 5, 8, 38, 40, 64, 73, 89, 236, 480, 486
Offset: 1

Views

Author

Altug Alkan, Mar 21 2016

Keywords

Comments

In other words, the primorial numbers that are considered are those of the form (p + q)/2 where p and q are consecutive primes. Note that the initial values of (p - q)/2 are 1, 1, 1, 23, 239, 191, 331, 373, 1021.
A088256 is a subsequence of these primorials, which in turn are a subsequence of A024675.
Numbers k such that A038711(k) = A060270(k). - Amiram Eldar, May 19 2024

Examples

			5 is a term because 2*3*5*7*11 = 2310 = (2309 + 2311)/2.
8 is a term because 2*3*5*7*11*13*17*19 = 9699690 = (9699667 + 9699713)/2.
		

Crossrefs

Programs

  • Maple
    P:= 2: count:= 0:
    for n from 2 to 500 do
      P:= P*ithprime(n);
      # first try d=1
      if isprime(P+1) then
        good:= isprime(P-1);
      elif isprime(P-1) then good:= false
      else
        for d from ithprime(n+1) by 2 do
          if igcd(d,P) > 1 then next fi;
          if isprime(P+d) then
            good:= isprime(P-d); break
          elif isprime(P-d) then
            good:= false; break
          fi
        od;
      fi;
      if good then
         count:= count+1;
         A[count]:= n;
      fi
    od:
    seq(A[i],i=1..count);  # Robert Israel, Aug 29 2016
  • Mathematica
    prim[n_] := Times @@ Prime[Range[n]]; Select[Range[2, 100], Total[NextPrime[(p = prim[#]), {-1, 1}]] == 2*p &] (* Amiram Eldar, May 19 2024 *)
  • PARI
    a002110(n) = prod(k=1, n, prime(k));
    for(n=2, 1e3, if((nextprime(a002110(n)) - a002110(n)) == (a002110(n) - precprime(a002110(n))), print1(n, ", ")))

A340041 The prime gap, divided by two, which surrounds p#.

Original entry on oeis.org

1, 1, 6, 1, 9, 24, 23, 40, 51, 37, 60, 36, 68, 87, 66, 84, 99, 95, 115, 88, 117, 143, 51, 177, 182, 168, 139, 243, 221, 193, 204, 516, 260, 154, 182, 306, 239, 216, 191, 211, 303, 263, 672, 303, 615, 417, 312, 378, 275, 375, 322, 445, 312, 294, 354, 492, 399, 348, 461
Offset: 2

Views

Author

Robert G. Wilson v, Jan 22 2021

Keywords

Comments

If p and q are consecutive primes, we say here that there is a gap of q-p. (Other sequences use different definitions of "gap".) - N. J. A. Sloane, Mar 07 2021
Records: 1, 6, 9, 24, 40, 51, 60, 68, 87, 99, 115, 117, 143, 177, 182, 243, 516, 672, 855, 915, 925, 1100, 1139, 1620, 1863, 2272, 2842, 4177, 4190, 5025, 5692, 6254, 6413, 6879, 7914, 8026, 9928, 10604, ..., .

Examples

			For a(1), 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(1) like A340013(2) is undefined.
For a(2), the prime gap contains {5, 6, 7}, with 3# = 6 in the middle. The prime gap is 2, therefore a(2) = 1;
For a(3), the prime gap contains {29, 30, 31}, with 5# = 30  in the middle. The prime gap is 2, therefore a(3) = 1.
For a(4), the prime gap contains {199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211}, with 7# =  205 in the middle. The prime gap is 12, therefore a(4) = 6. etc.
		

Crossrefs

Cf. A006862, A007014, A038711, A060270, A340013 (analog for n!).

Programs

  • Mathematica
    a[n_] := Block[{p = Times @@ Prime@ Range@ n}, (NextPrime[p, 1] - NextPrime[p, -1])/2]; a[1] = 0; Array[a, 60]

Formula

a(n) = (A006862(n) - A007014(n))/2 = (A038711(n) + A060270(n))/2.
a(n) = A058044(n)/2. - Hugo Pfoertner, Jan 22 2021
Showing 1-9 of 9 results.