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.

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

This page as a plain text file.
%I A079155 #6 Apr 15 2021 23:04:08
%S A079155 4,15,85,619,4800,39266,332276,2880818,25423985,227527467
%N A079155 The number of primes less than 10^n whose digital root (A038194) is also prime.
%e A079155 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}.
%t A079155 c = 0; k = 1; Do[ While[ k < 10^n, If[ PrimeQ[k] && PrimeQ[ Mod[k, 9]], c++ ]; k++ ]; Print[c], {n, 1, 8}]
%o A079155 (Python)
%o A079155 # use primerange (slower) vs. sieve.primerange (>> memory) for larger terms
%o A079155 from sympy import isprime, sieve
%o A079155 def afind(terms):
%o A079155   s = 0
%o A079155   for n in range(1, terms+1):
%o A079155     s += sum(isprime(p%9) for p in sieve.primerange(10**(n-1), 10**n))
%o A079155     print(s, end=", ")
%o A079155 afind(7) # _Michael S. Branicky_, Apr 15 2021
%Y A079155 The primes are in A078403, their digital roots are in A078400.
%K A079155 base,nonn
%O A079155 1,1
%A A079155 _Robert G. Wilson v_, Dec 27 2002
%E A079155 a(9)-a(10) from _Michael S. Branicky_, Apr 15 2021