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.

A212493 Let p_n=prime(n), n>=1. Then a(n) is the least prime p which differs from p_n, for which the intervals (p/2,p_n/2), (p,p_n], if pp_n, contain the same number of primes, and a(n)=0, if no such prime p exists.

Original entry on oeis.org

0, 5, 3, 3, 3, 17, 13, 23, 19, 19, 37, 31, 31, 47, 43, 59, 53, 67, 61, 0, 79, 73, 73, 73, 73, 0, 107, 103, 127, 131, 109, 113, 113, 151, 113, 139, 163, 157, 157, 179, 173, 0, 223, 197, 193, 233, 193, 191, 191, 193, 199, 0, 0, 257, 251, 251, 0, 277, 271, 271
Offset: 1

Views

Author

Keywords

Comments

a(n)=0 if and only if p_n is a peculiar prime, i.e., simultaneously Ramanujan (A104272) and Labos (A080359) prime (see sequence A164554).
a(n)>p_n if and only if p_n is Labos prime but not Ramanujan prime.

Examples

			Let n=5, p_5=11; p=2 is not suitable, since in (1,5.5) we have 3 primes, while in (2,11] there are 4 primes. Consider p=3. Now in intervals (1.5,5.5) and (3,11] we have the same number (3) of primes. Therefore, a(5)=3. The same value we can obtain by the formula. Since 11 is not a Labos prime, then a(5)=A080359(5-pi(5.5))=A080359(2)=3.
		

Crossrefs

Programs

  • Mathematica
    terms = 60; nn = Prime[terms];
    R = Table[0, {nn}]; s = 0; Do[If[PrimeQ[k], s++]; If[PrimeQ[k/2], s--]; If[s < nn, R[[s + 1]] = k], {k, Prime[3 nn]}];
    A104272 = R + 1;
    t = Table[0, {nn + 1}]; s = 0; Do[If[PrimeQ[k], s++]; If[PrimeQ[k/2], s--]; If[s <= nn && t[[s + 1]] == 0, t[[s + 1]] = k], {k, Prime[3 nn]}];
    A080359 = Rest[t];
    a[n_] := Module[{}, pn = Prime[n]; If[MemberQ[A104272, pn] && MemberQ[ A080359, pn], Return[0]]; For[p = 2, True, p = NextPrime[p], Which[ppn, If[PrimePi[p/2] - PrimePi[pn/2] == PrimePi[p] - PrimePi[pn], Return[p]]]]];
    Array[a, terms] (* Jean-François Alcover, Dec 04 2018, after T. D. Noe in A104272 *)

Formula

If p_n is not a Labos prime, then a(n) = A080359(n-pi(p_n/2)).