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-4 of 4 results.

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

Original entry on oeis.org

2, 3, 5, 7, 11, 23, 29, 41, 43, 47, 61, 83, 101, 113, 131, 137, 151, 173, 191, 223, 227, 241, 263, 281, 311, 313, 317, 331, 353, 401, 421, 443, 461, 599, 601, 641, 797, 821, 887, 911, 977, 1013, 1019, 1031, 1033, 1051, 1091, 1103, 1109, 1123, 1163, 1181, 1213
Offset: 1

Views

Author

Rick L. Shepherd, Apr 14 2002

Keywords

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

Examples

			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.
		

Crossrefs

Cf. A070026 (a supersequence), subsequences: A062802, A070028, A070029.

Programs

  • Mathematica
    dspQ[n_] := TrueQ[Union[PrimeQ[NestWhileList[Plus@@IntegerDigits[#] &, n, # > 9 &]]] == {True}]; Select[Prime[Range[200]], dspQ] (* Alonso del Arte, Aug 17 2011 *)
    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 *)
  • 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

Formula

Prime p is a term if and only if p < 10 or A007953(p) is a term. - Michael S. Branicky, May 22 2025

A207293 Primes p whose digit sum s(p) is also prime but whose iterated digit sum s(s(p)) is not prime.

Original entry on oeis.org

67, 89, 139, 157, 179, 193, 197, 199, 229, 269, 283, 337, 359, 373, 379, 397, 409, 449, 463, 467, 487, 557, 571, 577, 593, 607, 643, 647, 661, 683, 719, 733, 739, 751, 757, 773, 809, 823, 827, 829, 863, 881, 883, 919, 937, 953, 971, 991, 1039, 1093, 1097, 1129, 1187
Offset: 1

Views

Author

Jonathan Sondow, Jun 09 2012

Keywords

Comments

A046704 is primes p with s(p) also prime. A207294 is primes p with s(p) and s(s(p)) also prime. A070027 is primes p with all s(p), s(s(p)), s(s(s(p))), ... also prime. A104213 is primes p with s(p) not prime. A213354 is primes p with s(p) and s(s(p)) also prime but s(s(s(p))) not prime. A213355 is smallest prime p whose k-fold digit sum s(s(..s(p)..)) is also prime for all k < n, but not for k = n.

Examples

			67 is prime and s(67) = 6+7 = 13 is also prime, but s(s(67)) = s(13) = 1+3 = 4 is not prime. Since no smaller prime has this property, a(1) = 67.
		

Crossrefs

Programs

  • Maple
    isA207293 := proc(n)
        local d;
        if isprime(n) then
            d := digsum(n) ;
            if isprime(d) then
                d := digsum(d) ;
                if isprime(d) then
                    false ;
                else
                    true ;
                end if;
            else
                false ;
            end if;
        else
            false;
        end if;
    end proc:
    A207293 := proc(n)
        option remember ;
        if n = 1 then
            67 ;
        else
            a := nextprime(procname(n-1)) ;
            while not isA207293(a) do
                a := nextprime(a) ;
            end do:
            a ;
        end if;
    end proc: # R. J. Mathar, Feb 04 2021
  • Mathematica
    Select[Prime[Range[300]],
    PrimeQ[Apply[Plus, IntegerDigits[#]]] && !
        PrimeQ[Apply[Plus, IntegerDigits[Apply[Plus, IntegerDigits[#]]]]] &]
    idsQ[n_]:=PrimeQ[Rest[NestList[Total[IntegerDigits[#]]&,n,2]]]=={True,False}; Select[Prime[Range[200]],idsQ] (* Harvey P. Dale, Dec 28 2013 *)
  • PARI
    select(p->my(s=sumdigits(p));isprime(s)&&!isprime(sumdigits(s)), primes(1000)) \\ Charles R Greathouse IV, Jun 10 2012

A207294 Primes p whose digit sum s(p) and iterated digit sum s(s(p)) are also prime.

Original entry on oeis.org

2, 3, 5, 7, 11, 23, 29, 41, 43, 47, 61, 83, 101, 113, 131, 137, 151, 173, 191, 223, 227, 241, 263, 281, 311, 313, 317, 331, 353, 401, 421, 443, 461, 599, 601, 641, 797, 821, 887, 911, 977, 1013, 1019, 1031, 1033, 1051, 1091, 1103, 1109, 1123, 1163, 1181, 1213, 1217
Offset: 1

Views

Author

Jonathan Sondow, Jun 09 2012

Keywords

Comments

Sum_{a(n) < x} 1/a(n) is asymptotic to (9/4)*log(log(log(log(x)))) as x -> infinity; see Harman (2012). Thus the sequence is infinite.
The first member not in A070027 is 59899999.
A046704 is primes p with s(p) also prime. A070027 is primes p with all s(p), s(s(p)), s(s(s(p))), ... also prime. 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 whose k-fold digit sum s(s(..s(p)..)) is also prime for all k < n, but not for k = n.

Examples

			59899999 and s(59899999) = 5+9+8+9+9+9+9+9 = 67 and s(s(59899999)) = s(67) = 6+7 = 13 are all primes, so 59899999 is a member. But s(s(s(59899999))) = s(13) = 1+3 = 4 is not prime, so 59899999 is not a member of A070027.
		

Crossrefs

Programs

  • Mathematica
    Select[Prime[Range[200]], PrimeQ[Apply[Plus, IntegerDigits[#]]] && PrimeQ[Apply[Plus, IntegerDigits[Apply[Plus, IntegerDigits[#]]]]] &]
  • PARI
    select(p->my(s=sumdigits(p));isprime(s)&&isprime(sumdigits(s)), primes(1000)) \\ Charles R Greathouse IV, Jun 10 2012

A213355 Smallest prime p whose k-fold digit sum s(s(..s(p)..)) is also prime for all k < n, but whose n-fold digit sum is not prime.

Original entry on oeis.org

13, 67, 59899999
Offset: 1

Views

Author

Jonathan Sondow, Jun 10 2012

Keywords

Comments

The next term has more than 6655555 digits, because s(a(4)) >= a(3) = 59899999 and 59899999/9 > 6655555.
s(a(2)) = a(1) and s(a(3)) = a(2). Can one prove that s(a(n+1)) = a(n), for all n > 0? (Cf. formula below.) If yes, then a(n+1) is the smallest prime p with s(p) = a(n).
A046704 is primes p with s(p) also prime. A207294 is primes p with s(p) and s(s(p)) also prime. A070027 is primes p with all s(p), s(s(p)), s(s(s(p))), ... also prime. 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))).

Examples

			s(13) = 1+3 = 4 is not prime, and s(p) is prime if p < 13, so a(1) = 13.
s(67) = 6+7 = 13 is prime, but s(s(67)) = s(13) = 1+3 = 4 is not prime, and no p < 67 has this property, so a(2) = 67.
s(59899999) = 5+9+8+9+9+9+9+9 = 67 and s(s(59899999)) = s(67) = 6+7 = 13 are prime, but s(s(s(59899999))) = s(13) = 1+3 = 4 is not prime, and no p < 59899999 has this property, so a(3) = 59899999.
		

Crossrefs

a(1) = A104213(1), a(2) = A207293(1), a(3) = A213354(1).

Formula

a(n) <= s(a(n+1)). (Proof: a(n) and s(a(n+1)) share the same property, but a(n) is minimal.)
Showing 1-4 of 4 results.