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

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

A062816 a(n) = phi(n)*tau(n) - 2n = A000010(n)*A000005(n) - 2*n.

Original entry on oeis.org

-1, -2, -2, -2, -2, -4, -2, 0, 0, -4, -2, 0, -2, -4, 2, 8, -2, 0, -2, 8, 6, -4, -2, 16, 10, -4, 18, 16, -2, 4, -2, 32, 14, -4, 26, 36, -2, -4, 18, 48, -2, 12, -2, 32, 54, -4, -2, 64, 28, 20, 26, 40, -2, 36, 50, 80, 30, -4, -2, 72, -2, -4, 90, 96, 62, 28, -2, 56, 38, 52, -2, 144, -2, -4, 90, 64, 86, 36, -2, 160, 108, -4, -2, 120, 86, -4
Offset: 1

Views

Author

Labos Elemer, Jul 20 2001

Keywords

Comments

It can be shown that phi(n)*tau(n) >= n, which means that quotient = n/tau(n) <= phi(n); note: a(n)+5 is positive.
The value is always positive except when a(n) = 0 for {8,9,12}; or a(n) = -2 for primes together with 4 (i.e., for A046022 but without 1); or a(n) = -4 for A001747 (without 2 and 4); or a(n) = -1 for n = 1.

Crossrefs

Programs

  • Mathematica
    Table[EulerPhi[n]DivisorSigma[0,n]-2n,{n,90}] (* Harvey P. Dale, Feb 03 2021 *)
  • PARI
    a(n)={eulerphi(n)*numdiv(n) - 2*n} \\ Harry J. Smith, Aug 11 2009

Formula

a(n) = A062355(n) - 2*n. - Amiram Eldar, Jul 10 2024

Extensions

Offset changed from 0 to 1 by Harry J. Smith, Aug 11 2009
Showing 1-3 of 3 results.