OFFSET
1,2
COMMENTS
Similar to A338924, however this sequence does not account for the prime digits of a(n) itself.
Each prime term is the sum of all prime digits of each previous term.
EXAMPLE
a(16) = 13 because the sum of the prime digits from the previous terms is 2+2+5+2+2 = 13 (a prime) and 13 is less than the next nonprime (22).
a(17) = 22 because the sum of the prime digits from the previous terms is 2+2+5+2+2+3 = 16 (a nonprime), so a(17) is the next nonprime in the sequence.
a(18) = 24 because the sum of the prime digits from the previous terms is 2+2+5+2+2+3+2+2 = 20 (a nonprime).
a(16) = 25 because the sum of the prime digits from the previous terms is 2+2+5+2+2+3+2+2+2 = 22 (a nonprime).
a(17) = 26 because the sum of the prime digits from the previous terms is 2+2+5+2+2+3+2+2+2+2+5 = 29 (a prime) but it is not less than the next nonprime (which is 26).
PROG
(PARI) a(n)=my(v=[1], S=0, k=1, C=4, m); while(k<n, while(isprime(C), C++); m=vecsum(select(isprime, digits(S))); if(isprime(S) && (S<C) && !vecsearch(vecsort(v), S), v=concat(v, S); S+=m, S+= vecsum(select(isprime, digits(C))); v=concat(v, C); C++); k++); v[#v]
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Eric Angelini and Derek Orr, Nov 17 2020
STATUS
approved