login
a(1)=1. For n >= 2, let S be the sum of all prime digits in a(1), a(2), ... a(n-1) and let C be the next nonprime number not already in the sequence. If S is a prime less than C and is not already a term of the sequence, a(n) = S. Otherwise, a(n) = C.
0

%I #23 May 08 2021 08:30:44

%S 1,4,6,8,9,10,12,2,14,15,16,18,20,11,21,13,22,24,25,26,27,28,30,32,33,

%T 34,35,36,38,39,40,42,44,45,46,48,49,50,51,52,54,55,56,57,58,60,62,63,

%U 64,65,66,68,69,70,72,74,75,76,77,78,80,81,82,84,85,86,87,88,90

%N a(1)=1. For n >= 2, let S be the sum of all prime digits in a(1), a(2), ... a(n-1) and let C be the next nonprime number not already in the sequence. If S is a prime less than C and is not already a term of the sequence, a(n) = S. Otherwise, a(n) = C.

%C Similar to A338924, however this sequence does not account for the prime digits of a(n) itself.

%C Each prime term is the sum of all prime digits of each previous term.

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

%e 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.

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

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

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

%o (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]

%Y Cf. A338924.

%K nonn,base

%O 1,2

%A _Eric Angelini_ and _Derek Orr_, Nov 17 2020