login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Maximal sequence of primes whose digits are primes and whose digit sum is also a term.
0

%I #34 Mar 05 2023 19:49:45

%S 2,3,5,7,23,223,2777,7727,27527,33377,33773,35537,35573,35753,37337,

%T 52727,55337,55373,55733,73553,75227,75353,75533,222557,222773,223277,

%U 225257,225527,233357,235337,235553,253553,253733,277223,322727,323537,332573,335273

%N Maximal sequence of primes whose digits are primes and whose digit sum is also a term.

%C The sequence is maximal in the sense that a nonempty set of primes cannot be added consistently.

%e 2 is a term because it is a prime with prime digits only and its digit sum 2 is also a term.

%e 227 is not a term because the digit sum is 11 which is not a term because it has nonprime digits.

%e 27527 is a term: it is a prime, each digit (2,5,7) is also a prime, and the sum of the digits (2+7+5+2+7 = 23) is also in the sequence.

%p R:= {2,3,5,7}: count:= 4:

%p S:= [2,3,5,7];

%p for d from 2 to 11 do

%p S:= map(t -> (10*t+2,10*t+3,10*t+5,10*t+7), S);

%p for x in S do

%p if member(convert(convert(x,base,10),`+`),R) and isprime(x) then

%p R:= R union {x}; count:= count+1;

%p fi

%p od;

%p od:

%p sort(convert(R,list)); # _Robert Israel_, Mar 02 2023

%o (Python)

%o from sympy import isprime

%o seq = [2, 3, 5, 7]

%o for i in range(9, 10**6, 2):

%o s = str(i)

%o if set(s) <= set("2357") and sum(map(int, s)) in seq and isprime(i):

%o seq.append(i)

%o print(seq)

%Y A subsequence of A062088.

%Y Cf. A000040, A007953.

%K nonn,base

%O 1,1

%A _Hongwei Jin_, Feb 09 2023