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

A098969 Where the records (A098968) occur in A046930 (if initial term is 0 not 1).

Original entry on oeis.org

1, 2, 3, 4, 9, 16, 24, 30, 47, 189, 217, 327, 368, 739, 1184, 1663, 2225, 2226, 3385, 3386, 4059, 5949, 14357, 30803, 31545, 33609, 104071, 118505, 325854, 597313, 1319947, 2324142, 4140011, 4258997, 5911616, 8040880, 17567979, 23163300
Offset: 0

Views

Author

N. J. A. Sloane, Oct 24 2004

Keywords

Programs

  • Mathematica
    a = {1, 2}; b = {0, 1}; d = 1; p = 2; q = 3; Do[ r = Prime[n]; c = r - p - 2; If[c > d, Print[{n + 1, c}]; d = c; AppendTo[a, n - 1]; AppendTo[b, c]]; p = q; q = r, {n, 3, 10^9}]; a (* Robert G. Wilson v, Oct 27 2004 *)

Extensions

More terms from Robert G. Wilson v and Olaf Voß, Oct 27 2004

A023186 Lonely (or isolated) primes: increasing distance to nearest prime.

Original entry on oeis.org

2, 5, 23, 53, 211, 1847, 2179, 3967, 16033, 24281, 38501, 58831, 203713, 206699, 413353, 1272749, 2198981, 5102953, 10938023, 12623189, 72546283, 142414669, 162821917, 163710121, 325737821, 1131241763, 1791752797, 3173306951, 4841337887, 6021542119, 6807940367, 7174208683, 8835528511, 11179888193, 15318488291, 26329105043, 31587561361, 45241670743
Offset: 1

Views

Author

Keywords

Comments

Erdős and Suranyi call these reclusive primes and prove that there are an infinite number of them. They define these primes to be between two primes. Hence their first term would be 3 instead of 2. Record values in A120937. - T. D. Noe, Jul 21 2006

Examples

			The nearest prime to 23 is 4 units away, larger than any previous prime, so 23 is in the sequence.
The prime a(4) = A120937(3) = 53 is at distance 2*3 = 6 from its neighbors {47, 59}. The prime a(5) = A120937(4) = A120937(5) = A120937(6) = 211 is at distance 2*6 = 12 from its neighbors {199, 223}. Sequence A120937 requires the terms to have 2 neighbors, therefore its first term is 3 and not 2. - _M. F. Hasler_, Dec 28 2015
		

References

  • Paul Erdős and Janos Suranyi, Topics in the theory of numbers, Springer, 2003.

Crossrefs

Programs

  • Mathematica
    p = 0; q = 2; i = 0; Do[r = NextPrime[q]; m = Min[r - q, q - p]; If[m > i, Print[q]; i = m]; p = q; q = r, {n, 1, 152382000}]
    Join[{2},DeleteDuplicates[{#[[2]],Min[Differences[#]]}&/@Partition[Prime[ Range[ 2,10^6]],3,1],GreaterEqual[ #1[[2]],#2[[2]]]&][[;;,1]]] (* The program generates the first 20 terms of the sequence. *) (* Harvey P. Dale, Aug 31 2023 *)

Extensions

More terms from Jud McCranie, Jun 16 2000
More terms from T. D. Noe, Jul 21 2006

A051701 Closest prime to n-th prime p that is different from p (break ties by taking the smaller prime).

Original entry on oeis.org

3, 2, 3, 5, 13, 11, 19, 17, 19, 31, 29, 41, 43, 41, 43, 47, 61, 59, 71, 73, 71, 83, 79, 83, 101, 103, 101, 109, 107, 109, 131, 127, 139, 137, 151, 149, 151, 167, 163, 167, 181, 179, 193, 191, 199, 197, 199, 227, 229, 227, 229, 241, 239, 257, 251, 257, 271, 269
Offset: 1

Views

Author

Keywords

Comments

A227878 gives the terms occurring twice. - Reinhard Zumkeller, Oct 25 2013

Examples

			Closest primes to 2,3,5,7,11 are 3,2,3,5,13.
		

Crossrefs

Programs

  • Haskell
    a051701 n = a051701_list !! (n-1)
    a051701_list = f 2 $ 1 : a000040_list where
       f d (q:ps@(p:p':_)) = (if d <= d' then q else p') : f d' ps
         where d' = p' - p
    -- Reinhard Zumkeller, Oct 25 2013
    
  • Mathematica
    a[n_] := (p = Prime[n]; np = NextPrime[p]; pp = NextPrime[p, -1]; If[np-p < p-pp, np, pp]); Table[a[n], {n, 1, 58}] (* Jean-François Alcover, Oct 20 2011 *)
    cp[{a_,b_,c_}]:=If[c-bHarvey P. Dale, Oct 08 2012 *)
  • Python
    from sympy import nextprime
    def aupton(terms):
      prv, cur, nxt, alst = 0, 2, 3, []
      while len(alst) < terms:
        alst.append(prv if 2*cur - prv <= nxt else nxt)
        prv, cur, nxt = cur, nxt, nextprime(nxt)
      return alst
    print(aupton(58)) # Michael S. Branicky, Jun 04 2021

Extensions

More terms from James Sellers

A098968 Record values for size of sea of composite numbers surrounding primes.

Original entry on oeis.org

0, 1, 2, 4, 8, 10, 12, 16, 22, 26, 38, 40, 42, 46, 48, 54, 56, 70, 74, 78, 80, 98, 112, 114, 124, 136, 138, 158, 188, 198, 232, 234, 244, 246, 268, 304, 326, 328, 334, 338, 370
Offset: 0

Views

Author

N. J. A. Sloane, Oct 24 2004

Keywords

Comments

For a prime p let s(p) (essentially A046930) denote the number of composite numbers less than p and greater than max{1, previous prime} or greater than p and less than the next prime. Sequence gives record values of s(p).

Crossrefs

Records in A046930 (if initial term is 0 not 1). Cf. A098969, A046931.

Programs

  • Mathematica
    a = {1, 2}; b = {0, 1}; d = 1; p = 2; q = 3; Do[ r = Prime[n]; c = r - p - 2; If[c > d, Print[{n + 1, c}]; d = c; AppendTo[a, n - 1]; AppendTo[b, c]]; p = q; q = r, {n, 3, 10^9}]; b (* Robert G. Wilson v, Oct 27 2004 *)
    Join[{0},DeleteDuplicates[Total/@Partition[Differences[Prime[Range[5*10^6]]]-1,2,1],GreaterEqual]] (* The program generates the first 34 terms of the sequence. *) (* Harvey P. Dale, May 25 2025 *)

Extensions

More terms from Robert G. Wilson v and Olaf Voß, Oct 27 2004

A159461 Numbers of previous and following composites of n-th prime.

Original entry on oeis.org

0, 1, 2, 4, 4, 4, 4, 4, 8, 6, 6, 8, 4, 4, 8, 10, 6, 6, 8, 4, 6, 8, 8, 12, 10, 4, 4, 4, 4, 16, 16, 8, 6, 10, 10, 6, 10, 8, 8, 10, 6, 10, 10, 4, 4, 12, 22, 14, 4, 4, 8, 6, 10, 14, 10, 10, 6, 6, 8, 4, 10, 22, 16, 4, 4, 16, 18, 14, 10, 4, 8, 12, 12, 10, 8, 8, 12
Offset: 1

Views

Author

Jaroslav Krizek, Apr 12 2009

Keywords

Comments

Essentially the same as A046930. - R. J. Mathar, Apr 16 2009
For twin primes this is the gap before or after the twins, e.g., a(17) = 6 = 59 - 53 = prime(17) - prime(16) for the twin (59, 61) with a(18) = 6 = 67 - 61 = prime(19) - prime(18). - Frank Ellermann, Mar 17 2020

Examples

			For a(16) = 10 = 59 - 47 - 2 = prime(16+1) - prime(16-1) - 2 is the sum of the prime gaps minus two ending and starting at prime(16) = 53.
		

Crossrefs

Programs

  • Mathematica
    Join[{0},Total[Differences[#]-1]&/@Partition[Prime[Range[60]],3,1]] (* Harvey P. Dale, Nov 27 2011 *)

Formula

For n >= 2, we have
a(n) = A001223(n) + A001223(n-1) - 2;
a(n) = A046933(n) + A046933(n-1);
a(n) = A008578(n+2) - A008578(n) - 2;
a(n) = A158611(n+3) - A158611(n+1) - 2.

Extensions

Correction for change of offset in A158611 and A008578 in Aug 2009 Jaroslav Krizek, Jan 27 2010

A174950 Size of sea of semiprimes surrounding n-th prime.

Original entry on oeis.org

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

Views

Author

Juri-Stepan Gerasimov, Apr 02 2010

Keywords

Comments

Numbers of previous and following semiprimes of n-th prime.

Examples

			a(1)=0 because first prime is in a sea of 0 semiprimes; a(2)=1 because 2nd prime is in a sea of 1 semiprimes (3, 4); a(3)=2 because 3rd prime is in a sea of 2 semiprimes (4, 5, 6); a(4)=1 because 4th prime is in a sea of 1 semiprimes (6, 7); a(4)=2 because 5th prime is in a sea of 2 semiprimes (9, 10, 11).
		

Crossrefs

Extensions

Corrected by Ray Chandler, Apr 06 2010
Showing 1-6 of 6 results.