%I #31 Feb 12 2024 13:29:32
%S 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,
%T 25,25,27,28,29,29,30,31,32,32,34,35,36,37,38,39,41,42,42,43,44,45,46,
%U 47,48,48,50,51,51,52,52,53,55,56,57,58,59,60,60,61,63
%N a(n) = n + pi(n) - pi(n + pi(n)), where pi(n) is the prime count of n (n>=1).
%C It seems that this is a nondecreasing sequence and a(n) < n for n >= 2.
%C Proofs of the above observations are provided in the Links below.
%H Robert Israel, <a href="/A337978/b337978.txt">Table of n, a(n) for n = 1..10000</a>
%H Ya-Ping Lu, <a href="/A337978/a337978.pdf">Proofs of the two observations in the Comments section</a>
%F a(n) = n + pi(n) - pi(n + pi(n)).
%p f:= n -> n + numtheory:-pi(n) - numtheory:-pi(n + numtheory:-pi(n)):
%p map(f, [$1..100]); # _Robert Israel_, Feb 12 2024
%t pc[n_]:=With[{c=PrimePi[n]},n+c-PrimePi[n+c]]; Array[pc,70] (* _Harvey P. Dale_, Jan 18 2024 *)
%o (Python)
%o from sympy import primepi
%o print(1)
%o n = 2
%o for n in range(2, 10001):
%o n_f = n + primepi(n)
%o a = n_f - primepi(n_f)
%o print(a)
%o (PARI) a(n) = {my(x = n + primepi(n)); x - primepi(x); } \\ _Michel Marcus_, Oct 06 2020
%Y Cf. A000720, A062298, A095117, A337979.
%K nonn
%O 1,3
%A _Ya-Ping Lu_, Oct 06 2020