cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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).

This page as a plain text file.
%I A245281 #37 Sep 11 2014 17:38:16
%S A245281 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 A245281 38,48,40,42,27,57,45,50,52,54,44,46,56,58,68,60,62,64,66,63,39,9,69,
%U A245281 90,70,7,77,147,49,84,74,37,333,93,31,124,72,75,51,17,102
%N 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).
%C A245281 Is this a permutation of the integers >= 2? # _Robert Israel_, Sep 07 2014
%H A245281 Michel Lagneau, <a href="/A245281/b245281.txt">Table of n, a(n) for n = 1..3500</a>
%e A245281 a(16)=15 because GCD(a(16),a(15)) = GCD(15,21) = 3 and 1 is the common digit of 15 and 16.
%p A245281 S:= {2}:
%p A245281 A[1]:= 2:
%p A245281 L[1]:= {2}:
%p A245281 for n from 2 to 1000 do
%p A245281   k:= 0;
%p A245281   mS:= max(S);
%p A245281   Sp:= {$2..mS} minus S;
%p A245281   do
%p A245281      if Sp <> {} then
%p A245281         k:= min(Sp);
%p A245281         Sp:= Sp minus {k};
%p A245281      elif k < mS then k:= mS+1
%p A245281      else k:= k+1
%p A245281      fi;
%p A245281      if member(k,S) or igcd(k,A[n-1]) = 1 then next fi;
%p A245281      Lk:= convert(convert(k,base,10),set);
%p A245281      if Lk intersect L[n-1] <> {} then
%p A245281         A[n]:= k;
%p A245281         L[n]:= Lk;
%p A245281         S:= S union {k};
%p A245281         break
%p A245281      fi
%p A245281   od:
%p A245281 od:
%p A245281 seq(A[n],n=1..1000); # _Robert Israel_, Sep 07 2014
%t A245281 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 A245281 Cf. A064413, A184992.
%K A245281 nonn,base
%O A245281 1,1
%A A245281 _Michel Lagneau_, Sep 06 2014