|
|
A303657
|
|
a(n) is the least positive integer not yet in the sequence which shares a digit with a(n-2); a(1)=0, a(2)=1.
|
|
1
|
|
|
0, 1, 10, 11, 12, 13, 2, 3, 20, 23, 21, 22, 14, 24, 4, 25, 34, 5, 30, 15, 31, 16, 17, 6, 7, 26, 27, 28, 29, 8, 9, 18, 19, 38, 39, 32, 33, 35, 36, 37, 43, 47, 40, 41, 42, 44, 45, 46, 48, 49, 54, 59, 50, 51, 52, 53, 55, 56, 57, 58, 65, 68, 60, 61, 62, 63, 64, 66
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
COMMENTS
|
Up to n=34 the first differences of the sequence are bounded by -29 and 25; the bounds are -10 and 10 thereafter.
From a(103)=100 onwards, the sequence has slope = 1 with minor jumps about every 100 terms.
It appears that this sequence has an inverse, namely 1, 2, 7, 8, 15, 18, 24, 25, 30, 31, 3, 4, 5, 6, 13, 20, 22, 23, 32, 33, 9, ..., . - Robert G. Wilson v, Apr 29 2018 [Edited by Rémy Sigrist, May 06 2018]
|
|
LINKS
|
|
|
EXAMPLE
|
a(7)=2 since it is the least positive integer not yet in the sequence which shares a digit with a(5)=12.
|
|
MATHEMATICA
|
f[s_List] := Block[{k = 2, l = Union@ IntegerDigits@ s[[-2]]}, While[MemberQ[s, k] || Intersection[l, IntegerDigits@ k] == {}, k++]; Append[s, k]]; Nest[f, {0, 1}, 70] (* Robert G. Wilson v, Apr 29 2018 *)
|
|
PROG
|
(PARI) Digits(x, b)=if(!x, [0], digits(x, b));
firstTerms(n, {k=2}, {b=10})={my(N=b*n); my(s=List(vector(N, u, u-1)), t, x, y); for(m=k+1, n, x=Set(Digits(s[m-k], b)); for(i=m, N, y=Set(Digits(s[i], b)); if(#setintersect(x, y), t=s[i]; listpop(s, i); listinsert(s, t, m); break))); return(Vec(s)[1..n])}
(PARI) See Cano link.
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|