A107780 a(1)=9, a(n) = smallest integer not previously used which contains a digit from a(n-1).
9, 19, 1, 10, 0, 20, 2, 12, 11, 13, 3, 23, 21, 14, 4, 24, 22, 25, 5, 15, 16, 6, 26, 27, 7, 17, 18, 8, 28, 29, 32, 30, 31, 33, 34, 35, 36, 37, 38, 39, 43, 40, 41, 42, 44, 45, 46, 47, 48, 49, 54, 50, 51, 52, 53, 55, 56, 57, 58, 59, 65, 60, 61, 62, 63, 64, 66, 67, 68, 69, 76, 70
Offset: 1
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
Crossrefs
Programs
-
Maple
S:= [$0..100]: Res:= 9: S:= subs(9=NULL,S): digs:= {9}: while S <> [] do found:= false; for i from 1 to nops(S) while not found do ndigs:= convert(convert(S[i],base,10),set); if ndigs intersect digs <> {} then found:= true; Res:=Res, S[i]; S:= subsop(i=NULL, S); digs:= ndigs; fi od; if not found then break fi; od: Res; # Robert Israel, Jan 22 2020
-
Mathematica
f[l_] := Block[{c = 0}, While[ MemberQ[l, c] || Intersection @@ IntegerDigits /@{Last[l], c}=={}, c++ ];Return[Append[l, c]]];Nest[f, {9}, 70] (* Ray Chandler, Jul 19 2005 *)