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.

A078403 Primes whose digital root (A038194) is prime.

Original entry on oeis.org

2, 3, 5, 7, 11, 23, 29, 41, 43, 47, 59, 61, 79, 83, 97, 101, 113, 131, 137, 149, 151, 167, 173, 191, 223, 227, 239, 241, 257, 263, 277, 281, 293, 311, 313, 317, 331, 347, 349, 353, 367, 383, 389, 401, 419, 421, 439, 443, 457, 461, 479, 491, 509, 547, 563, 569
Offset: 1

Views

Author

N. J. A. Sloane, Dec 26 2002

Keywords

Comments

Union of A061238, A061240, A061241 and 3. - Ya-Ping Lu, Jan 03 2024

Examples

			59 is a term because 5+9=14, giving (final) iterated sum 1+4=5 and 5 is prime.
		

Crossrefs

Programs

  • Mathematica
    Select[ Range[580], PrimeQ[ # ] && PrimeQ[Mod[ #, 9]] &]
    Select[Prime[Range[200]],PrimeQ[Mod[#,9]]&] (* Harvey P. Dale, Aug 20 2017 *)
  • PARI
    forprime(p=2,997,if(isprime(p%9),print1(p,",")))
    
  • Python
    from sympy import isprime, primerange; [print(p, end = ', ') for p in primerange(2, 570) if isprime(p%9)] # Ya-Ping Lu, Jan 03 2024

Formula

a(n) ~ 2n log n. - Charles R Greathouse IV, May 14 2025

Extensions

A079155 The number of primes less than 10^n whose digital root (A038194) is also prime.

Original entry on oeis.org

4, 15, 85, 619, 4800, 39266, 332276, 2880818, 25423985, 227527467
Offset: 1

Views

Author

Robert G. Wilson v, Dec 27 2002

Keywords

Examples

			a(2) = 15 because the only primes less than 100 whose have digital roots are also prime are {2,3,5,7,11,23,29,41,43,47,59,61,79,83,97}.
		

Crossrefs

The primes are in A078403, their digital roots are in A078400.

Programs

  • Mathematica
    c = 0; k = 1; Do[ While[ k < 10^n, If[ PrimeQ[k] && PrimeQ[ Mod[k, 9]], c++ ]; k++ ]; Print[c], {n, 1, 8}]
  • Python
    # use primerange (slower) vs. sieve.primerange (>> memory) for larger terms
    from sympy import isprime, sieve
    def afind(terms):
      s = 0
      for n in range(1, terms+1):
        s += sum(isprime(p%9) for p in sieve.primerange(10**(n-1), 10**n))
        print(s, end=", ")
    afind(7) # Michael S. Branicky, Apr 15 2021

Extensions

a(9)-a(10) from Michael S. Branicky, Apr 15 2021
Showing 1-2 of 2 results.