OFFSET
1,2
EXAMPLE
a(1) = 0, k = 0, and the sum 0 is even;
a(2) = 2, k = 2, and the sum 0 + 2 (= 2) is even;
a(3) = 20, k = 2, and the sum 2 + 2 (= 4) is even;
a(4) = 4, k = 4, and the sum 2 + 2 + 0 + 4 (= 8) is even;
a(5) = 6, k = 6, and the sum 0 + 2 + 2 + 0 + 4 + 6 (= 14) is even;
a(6) = 21, k = 2, and the sum 6 + 2 (= 8) is even; etc.
MATHEMATICA
a[1]=0; a[n_]:=a[n]=Block[{k=1}, While[(p=First@IntegerDigits@k; p>Length[s=Flatten[IntegerDigits/@Join[Array[a, n-1], {p}]]])||MemberQ[Array[a, n-1], k]||!EvenQ@Total[s[[-p;; ]]], k++]; k]; Array[a, 79] (* Giorgos Kalogeropoulos, May 09 2022 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Eric Angelini and Carole Dubois, May 30 2021
STATUS
approved