OFFSET
1,2
COMMENTS
This sequence can be used as an alternate method of approximating the prime-counting function pi(n).
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..10000
Michael P. May, Properties of Higher-Order Prime Number Sequences, Missouri J. Math. Sci. (2020) Vol. 32, No. 2, 158-170; and arXiv version, arXiv:2108.04662 [math.NT], 2021.
Michael P. May, Approximating the Prime Counting Function via an Operation on a Unique Prime Number Subsequence, arXiv:2112.08941 [math.GM], 2021.
Michael P. May, Relationship Between the Prime-Counting Function and a Unique Prime Number Sequence, Missouri J. Math. Sci. (2023), Vol. 35, No. 1, 105-116.
FORMULA
EXAMPLE
For n = 3, a(3) = 17 - 13 = 4.
MAPLE
b:= proc(n) option remember;
`if`(isprime(n), 1+b(numtheory[pi](n)), 0)
end:
g:= proc(n) option remember; local p; p:= g(n-1);
do p:= nextprime(p);
if b(p)::even then break fi
od; p
end: g(1):=3:
a:= n-> (t-> t-prevprime(t))(g(n)):
seq(a(n), n=1..86); # Alois P. Heinz, Jan 06 2022
MATHEMATICA
fQ[n_]:=If[!PrimeQ[n]||(PrimeQ[n]&&FreeQ[lst, PrimePi[n]]), AppendTo[lst, n]]; k=2; lst={1}; While[k<10000000, fQ@k; k++]; tab1=Select[lst, PrimeQ]
lowerP[n_]:=Module[{m}, m=n; While[!PrimeQ[m-1], m--]; m-1]
tab2=lowerP/@tab1
tab3=tab1-tab2
CROSSREFS
KEYWORD
nonn
AUTHOR
Michael P. May, Oct 30 2021
STATUS
approved