%I #11 Nov 01 2019 09:28:44
%S 1,2,3,5,4,9,13,8,7,15,11,16,27,43,10,53,21,32,59,49,6,25,31,14,45,61,
%T 64,125,63,47,20,67,29,12,41,71,28,33,73,106,179,19,18,37,55,23,24,79,
%U 103,26,81,107,94,201,295,62,17,83,40,123,163,22,185,69,127,56,183,239
%N a(1)=1. a(2)=2. a(n) = smallest positive integer not occurring earlier in the sequence such that every positive integer <= and coprime to (a(n-1)+a(n-2)) is also coprime to a(n).
%C Is this sequence a permutation of the positive integers?
%e a(6)+a(7) = 22. The positive integers <= 22 and coprime to 22 are 1,3,5,7,9,13,15, 17,19,21. The smallest positive integer not occurring among the first 7 terms of the sequence which is coprime to 1,3,5,7,9,13,15,17,19, 21 is 8. (7 does not occur among the first 7 terms of {a(k)}, but 7 is not coprime to 7.) So a(8) = 8.
%t f[n_] := Select[Range[n], GCD[ #, n] == 1 &];g[l_List] := Block[{k = 1, t = f[l[[ -1]] + l[[ -2]]]},While[MemberQ[l, k] || Times @@ GCD[t, k] > 1, k++ ];Append[l, k]];Nest[g, {1, 2}, 66] (* _Ray Chandler_, Dec 24 2006 *)
%K nonn
%O 1,2
%A _Leroy Quet_, Dec 22 2006
%E Extended by _Ray Chandler_, Dec 24 2006