login
a(1)=2; for n > 1, a(n) is the least positive integer not occurring earlier that shares a digit and a factor with a(n-1).
1

%I #37 Sep 11 2014 17:38:16

%S 2,12,10,14,4,24,20,22,26,6,16,18,8,28,21,15,5,25,35,30,3,33,36,32,34,

%T 38,48,40,42,27,57,45,50,52,54,44,46,56,58,68,60,62,64,66,63,39,9,69,

%U 90,70,7,77,147,49,84,74,37,333,93,31,124,72,75,51,17,102

%N a(1)=2; for n > 1, a(n) is the least positive integer not occurring earlier that shares a digit and a factor with a(n-1).

%C Is this a permutation of the integers >= 2? # _Robert Israel_, Sep 07 2014

%H Michel Lagneau, <a href="/A245281/b245281.txt">Table of n, a(n) for n = 1..3500</a>

%e a(16)=15 because GCD(a(16),a(15)) = GCD(15,21) = 3 and 1 is the common digit of 15 and 16.

%p S:= {2}:

%p A[1]:= 2:

%p L[1]:= {2}:

%p for n from 2 to 1000 do

%p k:= 0;

%p mS:= max(S);

%p Sp:= {$2..mS} minus S;

%p do

%p if Sp <> {} then

%p k:= min(Sp);

%p Sp:= Sp minus {k};

%p elif k < mS then k:= mS+1

%p else k:= k+1

%p fi;

%p if member(k,S) or igcd(k,A[n-1]) = 1 then next fi;

%p Lk:= convert(convert(k,base,10),set);

%p if Lk intersect L[n-1] <> {} then

%p A[n]:= k;

%p L[n]:= Lk;

%p S:= S union {k};

%p break

%p fi

%p od:

%p od:

%p seq(A[n],n=1..1000); # _Robert Israel_, Sep 07 2014

%t f[s_List]:=Block[{m=s[[-1]],k=2},While[MemberQ[s,k]||Intersection[IntegerDigits[k],IntegerDigits[m]]=={}||GCD[m,k]==1,k++];Append[s,k]];Nest[f,{2},71]

%Y Cf. A064413, A184992.

%K nonn,base

%O 1,1

%A _Michel Lagneau_, Sep 06 2014