login
Numbers k whose decimal representation ends with that of pi(k) (where pi denotes the prime counting function A000720).
1

%I #23 Apr 06 2021 20:39:25

%S 16,17,132,254,374,494,1196,2348,3487,4624,5757,6886,11373,22517,

%T 33597,44639,55646,66644,77629,88580,99550,99551,110486,219572,328268,

%U 436699,544946,653052,761059,869024,976855,1084604,1192399,2159962,3232398,4303026,4303027

%N Numbers k whose decimal representation ends with that of pi(k) (where pi denotes the prime counting function A000720).

%C This sequence contains the automorphic primes (A046883).

%C If p is an automorphic prime, then p-1 is a term of the sequence.

%H Chai Wah Wu, <a href="/A306572/b306572.txt">Table of n, a(n) for n = 1..310</a>

%e There are 7 prime numbers <= 17, and 17 ends with 7, hence 17 is a term.

%e There are 13 primes numbers <= 42, and 42 does not end with 13, hence 42 is not a term.

%t Select[Range[2, 10^6], Mod[#1, 10^(1 + Floor@ Log10[#2])] == #2 & @@ {#, PrimePi@ #} &] (* _Michael De Vlieger_, Apr 06 2021 *)

%o (PARI) pi=0; for (n=1, 4303027, if (n%10^max(1,#digits(pi+=isprime(n)))==pi, print1 (n ", ")))

%o (Python)

%o from sympy import primepi

%o A306572_list = [n for n, p in enumerate(primepi(k) for k in range(10**4)) if n > 0 and n % 10**len(str(p)) == p] # _Chai Wah Wu_, Apr 06 2021

%Y Cf. A000720, A046883, A067248.

%K nonn,base

%O 1,1

%A _Rémy Sigrist_, Feb 24 2019