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.

A070027 Prime numbers whose initial, all intermediate and final iterated sums of digits are primes.

This page as a plain text file.
%I A070027 #56 May 22 2025 08:32:04
%S A070027 2,3,5,7,11,23,29,41,43,47,61,83,101,113,131,137,151,173,191,223,227,
%T A070027 241,263,281,311,313,317,331,353,401,421,443,461,599,601,641,797,821,
%U A070027 887,911,977,1013,1019,1031,1033,1051,1091,1103,1109,1123,1163,1181,1213
%N A070027 Prime numbers whose initial, all intermediate and final iterated sums of digits are primes.
%C A070027 Subsequence of A046704; actually, exactly those numbers for which the orbit under A007953 is a subset of A046704. - _M. F. Hasler_, Jun 28 2009
%C A070027 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.
%C A070027 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
%H A070027 Alex Costea, <a href="/A070027/b070027.txt">Table of n, a(n) for n = 1..10000</a> (terms 1..1000 from Alois P. Heinz)
%H A070027 Glyn Harman, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL15/Harman/harman2.html">Counting Primes whose Sum of Digits is Prime</a>, J. Integer Seq., 15 (2012), Article 12.2.2.
%F A070027 Prime p is a term if and only if p < 10 or A007953(p) is a term. - _Michael S. Branicky_, May 22 2025
%e A070027 599 is a term because 599, 5+9+9 = 23 and 2+3 = 5 are all prime. 2999 is a term because 2999, 2+9+9+9 = 29, 2+9 = 11 and 1+1 = 2 are all prime. See A062802 and A070026 for related comments.
%t A070027 dspQ[n_] := TrueQ[Union[PrimeQ[NestWhileList[Plus@@IntegerDigits[#] &, n, # > 9 &]]] == {True}]; Select[Prime[Range[200]], dspQ] (* _Alonso del Arte_, Aug 17 2011 *)
%t A070027 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 *)
%o A070027 (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
%o A070027 (Python)
%o A070027 from sympy import isprime
%o A070027 def ok(n): return isprime(n) and (n < 10 or ok(sum(map(int, str(n)))))
%o A070027 print([k for k in range(2, 1214) if ok(k)]) # _Michael S. Branicky_, May 22 2025
%Y A070027 Cf. A070026 (a supersequence), subsequences: A062802, A070028, A070029.
%Y A070027 Cf. A007953, A046704, A104213, A207293, A207294, A213354, A213355.
%K A070027 nonn,base,easy
%O A070027 1,1
%A A070027 _Rick L. Shepherd_, Apr 14 2002