[go: up one dir, main page]

login
A098951 revision #13

A098951
Smallest available integer fitting the even/odd/even/odd/even... digit pattern (across adjacent numbers).
3
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 21, 23, 25, 27, 29, 41, 43, 45, 47, 49, 61, 63, 65, 67, 69, 81, 83, 85, 87, 89, 210, 10, 12, 14, 16, 18, 30, 32, 34, 36, 38, 50, 52, 54, 56, 58, 70, 72, 74, 76, 78, 90, 92, 94, 96, 98, 101, 212, 103, 214, 105, 216, 107, 218, 109
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
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
Cf. A030141.
Sequence in context: A039173 A103951 A342304 * A097962 A247813 A122639
KEYWORD
base,easy,nonn
AUTHOR
Eric Angelini, Oct 21 2004
STATUS
editing