login
A318698
a(n) is the smallest nonnegative integer of the same parity as n, not yet in the sequence, that shares a digit with a(n-1); a(0)=0.
1
0, 101, 10, 1, 12, 11, 14, 13, 16, 15, 18, 17, 70, 7, 72, 21, 2, 23, 20, 25, 22, 27, 24, 29, 26, 61, 6, 63, 30, 3, 32, 31, 34, 33, 36, 35, 38, 37, 74, 41, 4, 43, 40, 45, 42, 47, 44, 49, 46, 65, 50, 5, 52, 51, 54, 53, 56, 55, 58, 57, 76, 67, 60, 69, 62, 121, 28, 81, 8
OFFSET
0,2
COMMENTS
Conjecture: This is a permutation of the nonnegative integers.
The one-digit integers appear in the following order: 0,1,7,2,6,3,4,5,8,9.
LINKS
EXAMPLE
a(1)=101 since 101 is the smallest odd nonnegative integer not yet in the sequence that shares the digit 0 with a(0)=0;
a(2)=10 since 10 is the smallest even nonnegative integer not yet in the sequence that shares the digit 0 (and 1) with a(1)=101.
MAPLE
N:= 1000: # to stop before the first term > N
S0:= [seq(i, i=2..N, 2)]: S1:= [seq(i, i=1..N, 2)]:
D0:= map(t -> convert(convert(t, base, 10), set), S0):
D1:= map(t -> convert(convert(t, base, 10), set), S1):
A[0]:= 0: Da:= {0}: found:= true:
for n from 1 while found do
found:= false;
if n::even then
for j from 1 to nops(D0) do
if Da intersect D0[j] <> {} then
found:= true;
A[n]:= S0[j];
Da:= D0[j];
S0:= subsop(j=NULL, S0);
D0:= subsop(j=NULL, D0);
break
fi
od
else
for j from 1 to nops(D1) do
if Da intersect D1[j] <> {} then
found:= true;
A[n]:= S1[j];
Da:= D1[j];
S1:= subsop(j=NULL, S1);
D1:= subsop(j=NULL, D1);
break
fi
od
fi
od:
seq(A[i], i=0..n-2); # Robert Israel, Feb 05 2020
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Enrique Navarrete, Aug 31 2018
STATUS
approved