login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A343139
Numbers k that satisfy the condition digitsum(k) = digitsum(pi(k)) where pi is the prime counting function.
1
15, 27, 51, 63, 120, 130, 131, 142, 153, 164, 208, 218, 230, 242, 252, 262, 263, 274, 305, 318, 327, 338, 348, 360, 370, 381, 392, 413, 424, 435, 446, 456, 457, 702, 712, 722, 732, 805, 860, 901, 912, 922, 932, 1016, 1027, 1038, 1039, 1048, 1049, 1059, 1071, 1080
OFFSET
1,1
COMMENTS
a(7) = 131 is the first prime in this sequence.
A033548 (Honaker primes) is a subsequence of this sequence.
LINKS
EXAMPLE
153 is a term because the number of primes up to 153 is 36 and 1 + 5 + 3 = 9 = 3 + 6.
435 is a term because number of primes up to 435 is 84 and 4 + 3 + 5 = 12 = 8 + 4.
MATHEMATICA
fHQ[n_] := Plus @@ IntegerDigits@n == Plus @@ IntegerDigits@PrimePi@n; Select[Range[3000], fHQ[#] &]
PROG
(PARI) for(n=1, 5000, if(sumdigits(n)==vecsum(digits(primepi(n))), print1(n, ", " )));
(PARI) upto(n) = { my(q = 2, ulim = nextprime(n), pi = 0, res = List()); forprime(p = 3, ulim, pi++; for(i = q, p-1, if(sumdigits(i) == sumdigits(pi), listput(res, i) ) ); q = p ); res } \\ David A. Corneth, May 26 2021
(Python)
from sympy import primepi
def sd(n): return sum(map(int, str(n)))
def ok(n): return sd(n) == sd(primepi(n))
print(list(filter(ok, range(1, 1081)))) # Michael S. Branicky, May 28 2021
CROSSREFS
KEYWORD
nonn,easy,base
AUTHOR
K. D. Bajpai, Apr 06 2021
STATUS
approved