OFFSET
1,3
COMMENTS
Different from A097962.
Indeed, A097962 is required to be increasing. Therefore, a(31) = 210 can here be followed by a(32) = 10, while A097962(32) = 301. - M. F. Hasler, Mar 23 2019
LINKS
T. D. Noe, Table of n, a(n) for n = 1..10000
EXAMPLE
After a(30) = 89, a(31) must start with an even digit. A number consisting of one even digit would work, but they are all in the sequence already. A 2-digit number with first digit even and second digit odd would work, but they are also all in the sequence already. A 3-digit number would have to have even, odd, and even digits in that order. The smallest such number is 210, so a(31) = 210. - Michael B. Porter, Mar 25 2019
MATHEMATICA
altQ[n_] := n < 10 || Union[Total /@ Partition[ Mod[ IntegerDigits@n, 2], 2, 1]] == {1}; s = {0}; Do[j=1; While[ MemberQ[s, j] || EvenQ[s[[-1]] + First@ IntegerDigits@ j] || ! altQ[j], j++]; AppendTo[s, j], {68}]; s (* Giovanni Resta, Mar 05 2014 *)
(* longer, but faster *) eoQ[n_] := Module[{d = IntegerDigits[n], alt, i}, alt = Table[If[OddQ[i], -1, 1], {i, d}]; i = 1; While[i++; i <= Length[d] && alt[[i]] == alt[[1]]*(-1)^(i + 1)]; If[i <= Length[d], alt[[1]] = 0]; alt[[1]]]; nn = 10000; tev = {}; tod = {}; Do[If[eoQ[i] == -1, AppendTo[tod, i], If[eoQ[i] == 1, AppendTo[tev, i]]], {i, nn}]; t = {0}; While[tev != {} && tod != {}, If[OddQ[t[[-1]]], AppendTo[t, tev[[1]]]; tev = Rest[tev], AppendTo[t, tod[[1]]]; tod = Rest[tod]]]; t (* T. D. Noe, Mar 05 2014 *)
CROSSREFS
KEYWORD
base,easy,nonn,changed
AUTHOR
Eric Angelini, Oct 21 2004
STATUS
approved