login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A098951
Smallest available integer fitting the even/odd/even/odd/even... digit pattern (across adjacent numbers).
4
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
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
See also A377919.
Sequence in context: A039173 A103951 A342304 * A097962 A247813 A122639
KEYWORD
base,easy,nonn,changed
AUTHOR
Eric Angelini, Oct 21 2004
STATUS
approved