%I #10 Jan 28 2024 14:56:30
%S 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,
%T 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,
%U 2,2,2,2,3,5,5,7,7,11,11,11,11,13
%N Least prime p < n with pi(n-p) a square, or 0 if such a prime p does not exist.
%C According to the conjecture in A237706, a(n) should be positive for all n > 2.
%H Zhi-Wei Sun, <a href="/A237710/b237710.txt">Table of n, a(n) for n = 1..10000</a>
%H Z.-W. Sun, <a href="http://arxiv.org/abs/1402.6641">Problems on combinatorial properties of primes</a>, arXiv:1402.6641, 2014
%e a(5) = 3 since pi(5-3) = 1^2, but pi(5-2) = 2 is not a square.
%t SQ[n_]:=IntegerQ[Sqrt[n]]
%t q[n_]:=SQ[PrimePi[n]]
%t Do[Do[If[q[n-Prime[k]],Print[n," ",Prime[k]];Goto[aa]],{k,1,PrimePi[n-1]}];
%t Print[n," ",0];Label[aa];Continue,{n,1,100}]
%t 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 *)
%Y Cf. A000040, A000290, A000720, A237706.
%K nonn
%O 1,3
%A _Zhi-Wei Sun_, Feb 12 2014
|