login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A335294 a(n) = pi(n) - pi(Sum_{k=1..n-1} a(k)) with a(1) = 1, where pi() is the prime counting function A000720. 7
1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 2, 1, 1, 0, 1, 1, 2, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 2, 2, 1, 1, 0, 0, 1, 1, 1, 1, 2, 1, 2, 2, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 0, 0, 1, 1, 1, 1, 2, 1, 2, 2, 1, 0, 0, 0, 1, 1, 1, 1, 2, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,13
COMMENTS
Alkan, Booker, & Luca prove that every nonnegative integer appears infinitely often.
LINKS
Altug Alkan, Andrew R. Booker, and Florian Luca, On a recursively defined sequence involving the prime counting function, arXiv:2006.08013 [math.NT], 2020.
MAPLE
A[1]:= 1: S:= 1:
for n from 2 to 100 do
A[n]:= numtheory:-pi(n) - numtheory:-pi(S);
S:= S + A[n];
od:
seq(A[n], n=1..100); # Robert Israel, Jun 01 2020
MATHEMATICA
a[1] = 1; a[n_] := a[n] = PrimePi[n] - PrimePi[Sum[a[k], {k, 1, n-1}]]; Array[a, 100] (* Amiram Eldar, Jun 01 2020 *)
upto[nn_] := Reap[Block[{i=0, is=0, sp=2, p=2, s=1}, Sow@ 1; Do[ If[n == p, i++; p = NextPrime@ p]; Sow[i - is]; s += i - is; While[ s >= sp, is++; sp = NextPrime@ sp], {n, 2, nn}]]] [[2, 1]]; upto[97] (* Giovanni Resta, Jun 02 2020 *)
PROG
(PARI) a=vector(10^2); a[1] = 1; for(n=2, #a, a[n] = primepi(n) - primepi(sum(k=1, n-1, a[k]))); a
(PARI) first(n) = {my(res = vector(n), pp = 0, s = 1, ps=0); primepivec = vector(n); forprime(p = 2, n, primepivec[p] = 1; ); for(i = 2, n, primepivec[i] += primepivec[i-1] ); res[1] = 1; for(i = 2, n, if(isprime(i), pp++); res[i] = pp - ps; s+=(pp-ps); ps = primepivec[s]; ); res } \\ David A. Corneth, Jun 01 2020
(Python)
from sympy import primepi
A = [1]
S = 1
for n in range(1, 101):
A += [primepi(n+1) - primepi(S), ]
S += A[n]
print(A) # Indranil Ghosh, Jun 21 2020, after Maple
CROSSREFS
Cf. A000720, A335337 (when k appears), A334714 (partial sums).
Sequence in context: A319394 A278347 A120936 * A214438 A173432 A101675
KEYWORD
nonn,easy
AUTHOR
Altug Alkan, Jun 01 2020
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 05:55 EDT 2024. Contains 371964 sequences. (Running on oeis4.)