OFFSET
1,2
COMMENTS
For n > 1 there exist at most two n-digit terms. If n is a term of the sequence and n + 1 is prime then n + 1 is also in the sequence.
Numbers n such that pi(n) is equal to n - 10^floor(log(10, n)). - Farideh Firoozbakht, Jan 01 2015
MAPLE
A[1]:= 1: A[2]:= 2: A[3]:= 3:
count:= 3:
for k from 1 to 8 do
x:= 10^k; y:= x + numtheory:-pi(x);
while x < y and y < 10^(k+1) do
x:= y; y:= 10^k + numtheory:-pi(x);
od;
count:= count+1; A[count]:= x;
if isprime(x+1) then
count:= count+1; A[count]:= x+1
fi;
od:
seq(A[i], i=1..count); # Robert Israel, Dec 31 2014
MATHEMATICA
Select[Range[1000], IntegerQ[Log[10, # - PrimePi[#]]] &] (* Alonso del Arte, Jan 01 2015 *)
PROG
(PARI) for(n=1, 10^3, s=digits(n-primepi(n)-1); if(s==[]||vecmin(s)==9, print1(n, ", "))) \\ Derek Orr, Jan 02 2015
CROSSREFS
KEYWORD
nonn,hard
AUTHOR
Farideh Firoozbakht, Dec 31 2014
EXTENSIONS
a(19)-a(24) from Giovanni Resta, Jun 07 2020
STATUS
approved