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.

A110028 Primes with a prime number of digits, all of them prime, that add up to a prime.

This page as a plain text file.
%I A110028 #20 May 26 2023 10:48:24
%S A110028 23,223,227,337,353,373,557,577,733,757,773,22573,23327,25237,25253,
%T A110028 25523,27253,27527,32233,32237,32257,32323,32327,33223,33353,33377,
%U A110028 33533,33773,35227,35353,35533,35537,35573,35753,37223,37337,52237,52253,52727,53353
%N A110028 Primes with a prime number of digits, all of them prime, that add up to a prime.
%C A110028 First 7-digit number in this sequence is 2222333.
%C A110028 From _Michael De Vlieger_, Feb 02 2019: (Start)
%C A110028 First p-digit number in this sequence:
%C A110028     2                                       23
%C A110028     3                                      223
%C A110028     5                                    22573
%C A110028     7                                  2222333
%C A110028    11                              22222222223
%C A110028    13                            2222222225323
%C A110028    17                        22222222222225237
%C A110028    19                      2222222222222223527
%C A110028    23                  22222222222222222232723
%C A110028    29            22222222222222222222222222577
%C A110028    31          2222222222222222222222222232257
%C A110028    37    2222222222222222222222222222222235773
%C A110028   ...
%C A110028 (End)
%H A110028 Michael De Vlieger, <a href="/A110028/b110028.txt">Table of n, a(n) for n = 1..10000</a>
%e A110028 22573 is a term because 22573 is prime, it has five digits (5 is a prime), all digits (2,3,5,7) are prime, and the sum of the digits is 2+2+5+7+3 = 19, which is also a prime.
%p A110028 a:=proc(n) local nn: nn:=convert(n,base,10): if isprime(n) and isprime(nops(nn)) and map(isprime,nn)=[seq(true,i=1..nops(nn))] and isprime(add(nn[j],j=1..nops(nn))) then n fi end: seq(a(k),k=1..60000); # _Emeric Deutsch_, Apr 02 2006
%t A110028 Select[Prime@ Range@ 6000, And[PrimeQ@ Length@ #, AllTrue[#, PrimeQ], PrimeQ@ Total@ #] &@ IntegerDigits@ # &] (* or *)
%t A110028 With[{p = {2, 3, 5, 7}}, Table[Select[FromDigits /@ Select[Tuples[p, {q}], PrimeQ@ Total@ # &], PrimeQ], {q, Prime@ Range@ 3}]] // Flatten (* _Michael De Vlieger_, Feb 02 2019 *)
%o A110028 (Python)
%o A110028 from sympy import isprime, nextprime
%o A110028 from itertools import islice, product
%o A110028 def agen(): # generator of terms
%o A110028     p = 2
%o A110028     while True:
%o A110028         for d in product("2357", repeat=p-1):
%o A110028             for last in "37":
%o A110028                 if isprime(sum(map(int, s:="".join(d) + last))):
%o A110028                     if isprime(t:=int(s)):
%o A110028                         yield t
%o A110028         p = nextprime(p)
%o A110028 print(list(islice(agen(), 40))) # _Michael S. Branicky_, May 26 2023
%Y A110028 Cf. A000040, A062088.
%K A110028 nonn,base
%O A110028 1,1
%A A110028 _Sergio Pimentel_, Mar 31 2006