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.

A237710 Least prime p < n with pi(n-p) a square, or 0 if such a prime p does not exist.

Original entry on oeis.org

0, 0, 2, 2, 3, 5, 5, 7, 2, 2, 2, 2, 3, 5, 5, 7, 7, 11, 11, 11, 11, 13, 13, 17, 2, 2, 2, 2, 2, 2, 3, 5, 5, 7, 7, 11, 11, 11, 11, 13, 13, 17, 17, 17, 17, 19, 19, 23, 23, 23, 23, 29, 29, 29, 2, 2, 2, 2, 2, 2, 3, 5, 5, 7, 7, 11, 11, 11, 11, 13
Offset: 1

Views

Author

Zhi-Wei Sun, Feb 12 2014

Keywords

Comments

According to the conjecture in A237706, a(n) should be positive for all n > 2.

Examples

			a(5) = 3 since pi(5-3) = 1^2, but pi(5-2) = 2 is not a square.
		

Crossrefs

Programs

  • Mathematica
    SQ[n_]:=IntegerQ[Sqrt[n]]
    q[n_]:=SQ[PrimePi[n]]
    Do[Do[If[q[n-Prime[k]],Print[n," ",Prime[k]];Goto[aa]],{k,1,PrimePi[n-1]}];
    Print[n," ",0];Label[aa];Continue,{n,1,100}]
    lp[n_]:=Module[{p=2},While[!IntegerQ[Sqrt[PrimePi[n-p]]],p=NextPrime[p]];p]; Join[{0,0},Array[ lp,80,3]] (* Harvey P. Dale, Jan 28 2024 *)