cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-2 of 2 results.

A058049 Numbers k such that the sum of the digits of the first k primes is a prime.

Original entry on oeis.org

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
Offset: 1

Views

Author

Robert G. Wilson v, Nov 18 2000

Keywords

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.

Examples

			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.
		

Crossrefs

Corresponding primes: A104247. Primes: A000040, sum of digits of primes: A007605.
Cf. A051351.

Programs

  • Mathematica
    s = 0; Do[ s = s + Apply[ Plus, RealDigits[ Prime[ n ]] [[1]] ]; If[ PrimeQ[ s ], Print[ n ] ], {n, 1, 1000} ]
  • 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

Extensions

Edited by R. J. Mathar, Aug 04 2008

A075544 Primes which are the sum of the digital root of the first n primes for some n.

Original entry on oeis.org

2, 5, 17, 19, 23, 31, 37, 43, 71, 163, 179, 199, 263, 269, 347, 379, 389, 443, 467, 487, 499, 569, 601, 641, 643, 647, 683, 691, 709, 769, 821, 829, 857, 859, 919, 941, 947, 953, 967, 997, 1019, 1021, 1061, 1093, 1123, 1153, 1231, 1249, 1381, 1409, 1459
Offset: 1

Views

Author

Jon Perry, Oct 11 2002

Keywords

Crossrefs

Programs

  • Mathematica
    s = 0; Do[s = s + Mod[ Prime[n], 9]; If[ PrimeQ[s], Print[s]], {n, 1, 350} ]
    Select[Accumulate[Mod[Prime[Range[1000]],9]],PrimeQ] (* Harvey P. Dale, May 04 2012 *)
  • PARI
    sumdigits2(n)=local(c); while (n>9,c=0; while (n>0,c=c+n%10; n=n-n%10; n=n/10); n=c); n
    c=0; forprime (p=2,1000,c=c+sumdigits2(p); if (isprime(c),print1(c,",")))

Extensions

Edited by Robert G. Wilson v, Oct 14 2002
Definition corrected by M. F. Hasler, Apr 04 2007
Corrected by Harvey P. Dale, May 04 2012
Showing 1-2 of 2 results.