Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #13 May 10 2022 09:55:32
%S 0,2,3,12,5,6,4,8,14,15,9,13,32,23,16,24,25,18,7,17,19,28,34,35,26,27,
%T 33,37,39,36,43,52,29,44,38,46,48,47,55,53,54,49,57,58,45,64,59,65,66,
%U 74,63,56,67,68,77,73,75,69,86,83,79,89,78,85,76,92,84,98,97,88,94,99,102,95,93,87,108,96
%N Lexicographically earliest sequence S of distinct nonnegative terms such that the sum of the last k digits of S is prime, k being the rightmost digit of a(n) and k > 1.
%C No term ends with 1.
%e a(1) = 0, k must be > 1;
%e a(2) = 2, k = 2, and the sum 0 + 2 (= 2) is prime;
%e a(3) = 3, k = 3, and the sum 0 + 2 + 3 (= 5) is prime;
%e a(4) = 12, k = 2, and the sum 1 + 2 (= 3) is prime;
%e a(5) = 5, k = 5, and the sum 2 + 3 + 1 + 2 + 5 (= 13) is prime;
%e a(6) = 6, k = 6, and the sum 2 + 3 + 1 + 2 + 5 + 6 (= 19) is prime; etc.
%t a[1]=0;a[n_]:=a[n]=Block[{t=1},While[(k=t~Mod~10;k>Length[s=Flatten[IntegerDigits/@Join[Array[a,n-1],{t}]]])||k<2||MemberQ[Array[a,n-1],t]||!PrimeQ@Total[s[[-k;;]]],t++];t];Array[a,78] (* _Giorgos Kalogeropoulos_, May 10 2022 *)
%Y Cf. A344539 and A344540.
%K base,nonn
%O 1,2
%A _Eric Angelini_ and _Carole Dubois_, May 22 2021