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”).

A298208
a(n) is the smallest positive integer not yet in the sequence that shares a digit with a(n-2) and shares no digit with a(n-1); a(1) = 0, a(2) = 1.
1
0, 1, 20, 11, 2, 10, 22, 13, 24, 3, 4, 23, 14, 25, 16, 5, 6, 15, 26, 17, 28, 7, 8, 27, 18, 29, 31, 9, 12, 39, 21, 30, 19, 32, 41, 33, 40, 35, 42, 36, 44, 37, 45, 38, 46, 53, 47, 50, 34, 51, 43, 52, 48, 55, 49, 56, 74, 58, 64, 57, 60, 54, 61, 59, 62, 75, 63, 70
OFFSET
1,3
COMMENTS
Initial fixed points are 47, 52, 56, 58, 72, 81, 94, 101, 13661, 13663. - Corrected and extended by Robert Israel, Feb 09 2018
Inverse: 0, 1, 4, 9, 10, 15, 16, 21, 22, 27, 5, 3, 28, 7, 12, 17, 14, 19, 24, 32, 2, 30, 6, 11, 8, 13, 18, 23, 20, 25, 31, ..., . - Robert G. Wilson v, Feb 09 2018
LINKS
MAPLE
N:= 1000: # to get all terms before the first term > N
a[1] := 0: a[2] := 1: first := 2:
Next := Array(2 .. N, i -> i+1):
Prev := Array(2 .. N, i -> i-1): Prev[2] := 0:
for n from 0 to N do
digs[n] := convert(convert(n, base, 10), set)
od:
for n from 3 do
D1 := digs[a[n-1]];
D2 := digs[a[n-2]];
t := first;
while digs[t] intersect D2 = {} or digs[t] intersect D1 <> {} do
t := Next[t];
if t > N then break fi
od;
if t > N then break fi;
a[n] := t;
if Prev[t] = 0 then first := Next[t] else Next[Prev[t]] := Next[t] fi; if Next[t] <= N then Prev[Next[t]] := Prev[t] fi
od:
seq(a[i], i=1..n-1); # Robert Israel, Feb 09 2018
MATHEMATICA
f[s_List] := Block[{a = Union@ IntegerDigits@ s[[-2]], b = Union@ IntegerDigits@ s[[-1]], k = 2}, While[id = Union@ IntegerDigits@ k; MemberQ[s, k] || Intersection[a, id] == {} || Intersection[b, id] != {}, k++]; Append[s, k]]; Nest[f, {0, 1}, 66] (* Robert G. Wilson v, Feb 09 2018 *)
CROSSREFS
Cf. A107353 (where each term must share a digit with the preceding term).
Cf. A297418.
Sequence in context: A033340 A040383 A058282 * A247337 A071160 A071153
KEYWORD
nonn,base,look
AUTHOR
Enrique Navarrete, Jan 15 2018
STATUS
approved