A337978 a(n) = n + pi(n) - pi(n + pi(n)), where pi(n) is the prime count of n (n>=1).
1, 1, 2, 3, 4, 5, 6, 7, 7, 8, 10, 10, 11, 12, 13, 14, 15, 16, 18, 19, 19, 20, 21, 22, 23, 24, 25, 25, 27, 28, 29, 29, 30, 31, 32, 32, 34, 35, 36, 37, 38, 39, 41, 42, 42, 43, 44, 45, 46, 47, 48, 48, 50, 51, 51, 52, 52, 53, 55, 56, 57, 58, 59, 60, 60, 61, 63
Offset: 1
Keywords
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
- Ya-Ping Lu, Proofs of the two observations in the Comments section
Programs
-
Maple
f:= n -> n + numtheory:-pi(n) - numtheory:-pi(n + numtheory:-pi(n)): map(f, [$1..100]); # Robert Israel, Feb 12 2024
-
Mathematica
pc[n_]:=With[{c=PrimePi[n]},n+c-PrimePi[n+c]]; Array[pc,70] (* Harvey P. Dale, Jan 18 2024 *)
-
PARI
a(n) = {my(x = n + primepi(n)); x - primepi(x); } \\ Michel Marcus, Oct 06 2020
-
Python
from sympy import primepi print(1) n = 2 for n in range(2, 10001): n_f = n + primepi(n) a = n_f - primepi(n_f) print(a)
Formula
a(n) = n + pi(n) - pi(n + pi(n)).
Comments