login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A058049 Numbers k such that the sum of the digits of the first k primes is a prime. 2
1, 2, 4, 5, 6, 7, 8, 11, 12, 14, 23, 33, 43, 45, 48, 64, 69, 72, 73, 77, 87, 94, 95, 96, 98, 110, 118, 124, 130, 133, 140, 148, 152, 154, 157, 162, 171, 174, 178, 181, 196, 200, 201, 206, 210, 212, 219, 232, 241, 244, 253, 257, 267, 269, 272, 277, 299, 304, 306 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
What is intriguing about this sequence is that the number of primes less than 10^m is of the same magnitude as A006880. Here they begin 7, 25, 122, 934.
LINKS
Z. Stankova-Frenkel and J. West, Explicit enumeration of 321,hexagon-avoiding permutations, arXiv:math/0106073 [math.CO], 2001.
EXAMPLE
5 is a term because sum of digits of first 5 primes, 2+3+5+7+(1+1)=19, is prime.
a(5) = 6 because in A051351(6) = 2 + 3 + 5 + 7 + 2 (sum of eleven's digits) + 4 (sum of thirteen's digits) which equals the sum of the digits through the sixth prime = 23 which itself is a prime.
MATHEMATICA
s = 0; Do[ s = s + Apply[ Plus, RealDigits[ Prime[ n ]] [[1]] ]; If[ PrimeQ[ s ], Print[ n ] ], {n, 0, 1000} ].
PROG
(PARI) isok(n) = isprime(sum(k=1, n, sumdigits(prime(k)))); \\ Michel Marcus, Mar 11 2017
(Python)
from sympy import isprime, nextprime
def sd(n): return sum(map(int, str(n)))
def aupto(limit):
alst, k, p, s = [], 1, 2, 2
while k <= limit:
if isprime(s): alst.append(k)
k += 1; p = nextprime(p); s += sd(p)
return alst
print(aupto(306)) # Michael S. Branicky, Jul 18 2021
CROSSREFS
Corresponding primes: A104247. Primes: A000040, sum of digits of primes: A007605.
Cf. A051351.
Sequence in context: A101742 A194831 A111688 * A091871 A303393 A039085
KEYWORD
nonn,base
AUTHOR
Robert G. Wilson v, Nov 18 2000
EXTENSIONS
Edited by R. J. Mathar, Aug 04 2008
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 14:50 EDT 2024. Contains 371792 sequences. (Running on oeis4.)