OFFSET
1,1
COMMENTS
Subsequence of A046704; actually, exactly those numbers for which the orbit under A007953 is a subset of A046704. - M. F. Hasler, Jun 28 2009
Supersequences: A046704 is primes p with digit sum s(p) also prime; A207294 is primes p with s(p) and s(s(p)) also prime.
Disjoint sequences: A104213 is primes p with s(p) not prime; A207293 is primes p with s(p) also prime, but not s(s(p)); A213354 is primes p with s(p) and s(s(p)) also prime, but not s(s(s(p))); A213355 is smallest prime p with k-fold digit sum s(s(..s(p)..)) also prime for all k < n, but not for k = n. - Jonathan Sondow, Jun 13 2012
LINKS
Alex Costea, Table of n, a(n) for n = 1..10000 (terms 1..1000 from Alois P. Heinz)
Glyn Harman, Counting Primes whose Sum of Digits is Prime, J. Int. Seq. 15 (2012), Art. 12.2.2.
Jens Lehmann, An Explicit Surjectivity Threshold for Digit Sums of Primes, arXiv:2606.04677 [math.NT], 2026. See pp. 1, 3, 74-77.
FORMULA
Prime p is a term if and only if p < 10 or A007953(p) is a term. - Michael S. Branicky, May 22 2025
EXAMPLE
MATHEMATICA
dspQ[n_] := TrueQ[Union[PrimeQ[NestWhileList[Plus@@IntegerDigits[#] &, n, # > 9 &]]] == {True}]; Select[Prime[Range[200]], dspQ] (* Alonso del Arte, Aug 17 2011 *)
(* Alternative: *)
isdpQ[n_]:=AllTrue[Rest[NestWhileList[Total[IntegerDigits[#]]&, n, #>9&]], PrimeQ]; Select[Prime[Range[300]], isdpQ] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Jul 12 2017 *)
PROG
(PARI) isA070027(n)={ while(isprime(n), n<9 && return(1); n=vector(#n=eval(Vec(Str(n))), i, 1)*n~)} \\ M. F. Hasler, Jun 28 2009
(Python)
from sympy import isprime
def ok(n): return isprime(n) and (n < 10 or ok(sum(map(int, str(n)))))
print([k for k in range(2, 1214) if ok(k)]) # Michael S. Branicky, May 22 2025
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
Rick L. Shepherd, Apr 14 2002
STATUS
approved
