Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #12 Jul 18 2014 21:52:11
%S 2,31,2621,9941,5599921,5599921,5219088341
%N a(n) is the smallest prime p such that p has at least one digit greater than 1 and all the n numbers ds(p), ds(ds(p)), ..., ds(ds(...(ds(p))...)) are primes. The function ds is defined in the comment lines.
%C ds(m) is the number that is obtained from m by replacing each positive digit i to sigma(i) and replacing zero by zero itself.
%C Example: ds(19)=1.13=113, ds(1028)=1.0.3.15=10315.
%C 1. If all digits of m are less than 2 then ds(m)=m. So for
%C primes p with digits less than 2 (terms of the sequence A020449) p=ds(p)=ds(ds(p))=ds(ds(ds(p)))= ... .
%C 2. For n>1, a(n) is of the form 10k+1.
%C 3. If o, i, s and t are respectively number of zeros, number of ones, number of digits greater than 1 and number of composite digits greater than 4 in decimal expansion of m also o', i', s' and t' are the same for ds(m) then o'=o, i'=i+t and s'=s.
%C Example: m=1021041629839
%C ds(m)=1.0.3.1.0.7.1.12.3.13.15.4.13=10310711231315413
%C => {o, i, s, t}={2, 3, 8, 4} and {o', i', s'}={o, i+t, s}= {2, 7, 8}.
%e a(3)=2621 because the three numbers:
%e 1. ds(2621)=3.12.3.1=31231
%e 2. ds(ds(2621))=4.1.3.41=41341
%e 3. ds(ds(ds(2621)))=7.1.4.71=71471
%e are all primes and 2621 is the smallest prime with this property.
%Y Cf. A000040, A020449, A244442.
%K nonn,base,hard,more
%O 1,1
%A _Jahangeer Kholdi_ and _Farideh Firoozbakht_, Jul 13 2014