A245281 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).
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, 38, 48, 40, 42, 27, 57, 45, 50, 52, 54, 44, 46, 56, 58, 68, 60, 62, 64, 66, 63, 39, 9, 69, 90, 70, 7, 77, 147, 49, 84, 74, 37, 333, 93, 31, 124, 72, 75, 51, 17, 102
Offset: 1
Examples
a(16)=15 because GCD(a(16),a(15)) = GCD(15,21) = 3 and 1 is the common digit of 15 and 16.
Links
- Michel Lagneau, Table of n, a(n) for n = 1..3500
Programs
-
Maple
S:= {2}: A[1]:= 2: L[1]:= {2}: for n from 2 to 1000 do k:= 0; mS:= max(S); Sp:= {$2..mS} minus S; do if Sp <> {} then k:= min(Sp); Sp:= Sp minus {k}; elif k < mS then k:= mS+1 else k:= k+1 fi; if member(k,S) or igcd(k,A[n-1]) = 1 then next fi; Lk:= convert(convert(k,base,10),set); if Lk intersect L[n-1] <> {} then A[n]:= k; L[n]:= Lk; S:= S union {k}; break fi od: od: seq(A[n],n=1..1000); # Robert Israel, Sep 07 2014
-
Mathematica
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]
Comments