%I #23 Oct 28 2024 14:12:37
%S 1,2,6,4,10,8,14,12,3,15,33,9,39,18,20,16,34,22,38,24,21,28,46,26,30,
%T 32,36,40,58,42,62,44,11,66,45,27,111,48,51,54,82,50,86,52,60,56,94,
%U 64,70,5,75,65,265,80,25,35,63,72,118,68,122,74,78,76,90,55,335,85,102,84,142
%N a(1) = 1; a(n) is the smallest number not yet used that is not relatively prime to n nor relatively prime to a(n-1).
%C Conjecture: this sequence includes every integer greater than 1.
%C In the first 200000 terms the only fixed points are 2, 4, 16, 21, 95, 159, 723, 18071. - _Scott R. Shannon_, Oct 25 2024
%H Scott R. Shannon, <a href="/A119018/b119018.txt">Table of n, a(n) for n = 1..10000</a>
%H Scott R. Shannon, <a href="/A119018/a119018.png">Image of the first 200000 terms for a(n) < 400000</a>. The green line is a(n) = n.
%e a(12) must have a common factor with 12 and a(11) = 33. The first few such values are 3, 6 and 9; 3 and 6 have already been used, so a(12)=9.
%p A119018 := proc(nmin) local a,anxt ; a := [0] ; while nops(a) < nmin do anxt := 1 ; n := nops(a)+1 ; while anxt in a or gcd(n,anxt) = 1 or gcd(op(-1,a),anxt) = 1 do anxt := anxt+1 ; od ; a := [op(a),anxt]; od: RETURN(a) ; end: A119018(100) ; # _R. J. Mathar_, Sep 07 2007
%t a = {0}; Do[k = 1; While[MemberQ[a, k] || GCD[k, n] == 1 || GCD[k, a[[-1]]] == 1, k++]; AppendTo[a, k], {n, 2, 71}]; a (* _Ivan Neretin_, Jul 09 2015 *)
%Y Cf. A119019.
%K nonn
%O 1,2
%A _Franklin T. Adams-Watters_, May 08 2006
%E Definition corrected by _R. J. Mathar_, Sep 07 2007
%E a(1) changed to a(1) = 1 by _Scott R. Shannon_, Oct 28 2024