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-10 of 11 results. Next

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

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

A213354 Primes p with digit sums s(p) and s(s(p)) also prime, but s(s(s(p))) not prime.

Original entry on oeis.org

59899999, 69899899, 69899989, 69979999, 69997999, 69999799, 77899999, 78997999, 78998989, 78999889, 78999979, 79699999, 79879999, 79889899, 79979899, 79979989, 79988899, 79989979, 79996999, 79997899, 79997989, 79999789, 79999879, 79999987
Offset: 1

Views

Author

Jonathan Sondow, Jun 10 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. A207293 is primes p with s(p) also prime, but not 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.
Contains primes with digit sums 67, 89, 139, 157, 179,...., A207293(.). So A106807 is a subsequence and examples of numbers in this sequence but not in A106807 are A067180(89), A067180(139) etc. - R. J. Mathar, Feb 04 2021

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, but s(s(s(59899999))) = s(13) = 1+3 = 4 is not prime. No smaller prime has this property, so a(1) = 59899999 = A213355(3).
		

Crossrefs

Programs

  • Mathematica
    Select[Prime[Range[5000000]], PrimeQ[Apply[Plus, IntegerDigits[#]]] && PrimeQ[Apply[Plus, IntegerDigits[Apply[Plus, IntegerDigits[#]]]]] && ! PrimeQ[Apply[Plus, IntegerDigits[Apply[Plus, IntegerDigits[Apply[Plus, IntegerDigits[#]]]]]]] &]

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.)

A070026 Initial, all intermediate and final iterated sums of digits of n are primes.

Original entry on oeis.org

2, 3, 5, 7, 11, 12, 14, 16, 20, 21, 23, 25, 29, 30, 32, 34, 38, 41, 43, 47, 50, 52, 56, 61, 65, 70, 74, 83, 92, 101, 102, 104, 106, 110, 111, 113, 115, 119, 120, 122, 124, 128, 131, 133, 137, 140, 142, 146, 151, 155, 160, 164, 173, 182, 191, 200, 201, 203, 205, 209, 210, 212, 214, 218
Offset: 1

Views

Author

Rick L. Shepherd, Apr 13 2002

Keywords

Comments

2999 = A062802(4) is the smallest term of this sequence for which the second iterated sum of digits is not the final sum; i.e. the smallest requiring three summations (2+9+9+9=29, 2+9=11, 1+1=2 and all three sums are prime). (The corresponding statement about the very large A062802(5) is not true because a large number of smaller nonprimes of the same digit length also have the digit sum 2999, the least being 29999..., where 333 9's follow the 2.). A062802, a sequence of primes, is a subsequence of this sequence and of A070027.
Additional terms can be generated by finding the next number whose digit sum is a prime already in the sequence. - Felix Fröhlich, Jun 13 2014

Examples

			47 is here because 4+7=11 and 11 is prime while also 1+1=2 and 2 is prime. 39 (in A028835) is not a term: 3+9=12 is not prime - although 1+2=3 is prime. 49 (in A028834) is not a term: 4+9=13 is prime but 1+3=4 is not prime.
		

Crossrefs

Cf. A028834 (Initial sum is prime), A028835 (Final sum is prime), A062802, A070027 (Primes from this sequence).

Extensions

Terms corrected by Felix Fröhlich, Jun 13 2014

A070028 Absolute primes: primes whose initial, all intermediate and final sums of digits are primes.

Original entry on oeis.org

2, 3, 5, 7, 11, 113, 131, 311, 11111111111111111111111
Offset: 1

Views

Author

Rick L. Shepherd, Apr 15 2002

Keywords

Comments

The next terms are R(317) and R(1031) where R(n)=(10^n-1)/9 is a repunit prime. This sequence is a subsequence of A003459 and A070027.

Examples

			113 is a term because 113 and permutations 131 and 311 are prime as is 1+1+3=5. 11111111111111111111111 is a term because it is prime, all permutations of its digits are prime, the sum of its digits, 23, is prime and 2+3=5 is also prime.
		

Crossrefs

Cf. A003459 (absolute primes), A004022 (repunit primes), A070027.

A070029 Primes with only prime digits and whose initial, all intermediate and final iterated sums of digits are primes.

Original entry on oeis.org

2, 3, 5, 7, 23, 223, 227, 353, 2333, 2777, 3323, 7727, 27527, 33377, 33773, 35537, 35573, 35753, 37337, 52727, 53777, 55337, 55373, 55733, 57557, 57737, 57773, 73553, 73757, 75227, 75353, 75377, 75533, 75557, 75773, 77573, 222557, 222773
Offset: 1

Views

Author

Rick L. Shepherd, Apr 21 2002

Keywords

Comments

This sequence is the intersection of A062088 and A070027.

Examples

			53777 is a term because 53777 is a prime with only prime digits and 5+3+7+7+7=29, 2+9=11 and 1+1=2 are all prime.
		

Crossrefs

Cf. A070027, A062088 (only first sum of digits is necessarily prime).

Programs

  • Mathematica
    iifpQ[n_]:=AllTrue[NestWhileList[Total[IntegerDigits[#]]&,n,#>9&],PrimeQ]; Select[Prime[Range[20000]],AllTrue[IntegerDigits[#],PrimeQ]&&iifpQ[#]&] (* Harvey P. Dale, Jul 18 2021 *)

A162658 Primes such that the sum of its smallest and largest decimal digits is an odd prime.

Original entry on oeis.org

23, 29, 41, 47, 61, 67, 83, 103, 107, 163, 211, 223, 229, 233, 241, 269, 293, 307, 383, 421, 431, 433, 443, 449, 457, 461, 467, 479, 491, 499, 503, 509, 523, 547, 587, 607, 613, 631, 641, 661, 677, 701, 829, 853, 857, 863, 883, 929, 947
Offset: 1

Views

Author

Parthasarathy Nambi, Jul 09 2009

Keywords

Examples

			947 is a prime in which the sum of the smallest digit (4) and the largest digit (9) is an odd prime (13).
		

Crossrefs

A384306 Primes whose sum of digits in both base 8 and base 10 are recursively prime down to 2, 3, 5, or 7.

Original entry on oeis.org

2, 3, 5, 7, 131, 311, 887, 1013, 1949, 2399, 2621, 2957, 3251, 3323, 3701, 4289, 4919, 4973, 5099, 5101, 5477, 5927, 5981, 6359, 6599, 6779, 6863, 8069, 8447, 8573, 8627, 8669, 8951, 9677, 10141, 10181, 10211, 10589, 10631, 11399, 11597, 12101, 12479, 12659, 12983
Offset: 1

Views

Author

Jean-Louis Lascoux, May 25 2025

Keywords

Comments

A prime p belongs to this sequence if in both bases 8 and 10 the iterative digit-sum process yields only prime values down to one of {2, 3, 5, 7}.

Examples

			a(5) = 131:
In base 8: 131 = 203_8 -> 2+0+3 = 5 -> 5 is prime -> ends in 5.
In base 10: 1+3+1 = 5 -> 5 is prime -> ends in 5.
All intermediate values for both bases are primes, and the last values are in {2,3,5,7}.
a(6) = 887:
In base 8: 887 = 1567_8 -> 1+5+6+7 = 19 -> 19 is prime -> 19 = 23_8 -> 2+3 = 5-> 5 is prime -> ends in 5.
In base 10: 8+8+7 = 23 -> 23 is prime -> 2+3 = 5 -> 5 is prime -> ends in 5.
All intermediate values for both bases are primes, and the last values are in {2,3,5,7}.
		

Crossrefs

Subsequence of A070027.

Programs

  • Maple
    q:= (n, k)-> isprime(n) and (n q(x, 8) and q(x, 10), [$1..20000])[];  # Alois P. Heinz, May 27 2025
  • PARI
    isokb(p,b) = while(1, my(s=sumdigits(p, b)); if (! isprime(s), return(0)); if (sMichel Marcus, May 27 2025
    
  • Python
    from gmpy2 import digits, is_prime
    def rp(n, b): return is_prime(n) and (n < b or rp(sum(map(int, digits(n, b))), b))
    def ok(n): return rp(n, 10) and rp(n, 8)
    print([k for k in range(2, 13000) if ok(k)]) # Michael S. Branicky, May 27 2025
Showing 1-10 of 11 results. Next