OFFSET
0,3
COMMENTS
Distinct from A098951, which is not required to be increasing. The first 31 terms are identical, but here a(30) = 210 must be followed by a(31) = 301, while there 210 is followed by 10. - M. F. Hasler, Mar 23 2019
LINKS
M. F. Hasler, Table of n, a(n) for n = 0..10000
MATHEMATICA
nn = 57; c[_] := False; a[0] = j = 0; p = 1; c[0] = True;
Do[k = j;
While[(Set[q, Mod[#[[-1]], 2]];
Nand[! c[k], Mod[#[[1]], 2] == p,
Union[Length /@ SplitBy[#, EvenQ]] == {1}]) &[IntegerDigits[k]],
k++]; Set[{a[n], j, p, c[k]}, {k, k, 1 - q, True}], {n, nn}];
Array[a, nn + 1, 0] (* Michael De Vlieger, Dec 09 2024 *)
PROG
(PARI) nxt(n, d=digits(n))={if(!bittest(#d, 0), forstep(i=#d, 1, -1, 10>(d[i]+=2)&& return(fromdigits(d)); d[i]-=10); d||return(1); d[#d]=if(d[1]%=2, 10, 21); fromdigits(Vecrev(d)), 10>d[1]+=1, d[1]=d[1]*10+d[#d]; fromdigits(d)\10, d[1]=21; fromdigits(d))}
vector(50, i, t=if(i>1, nxt(t), 0)) \\ M. F. Hasler, Mar 23 2019
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Eric Angelini, Sep 06 2004
STATUS
approved