OFFSET
1,2
COMMENTS
This sequence is a permutation of the positive integers.
EXAMPLE
The sequence grouped by runs, where run n, after the first 1, consists of a(n-1) terms:
1,(3),(2,4,5),(7,9),(6,8,11,12),(13,17,19,23,25),(10,15,16,18,20,22,24),...
a(5) is 5. So run 6 contains the first 5 positive integers which do not occur earlier in the sequence and which are coprime to 6, (13,17,19,23,25).
MATHEMATICA
f[l_List] := Block[{n = Length[l] + 1, fl = Flatten[l], c, k = 0, r = {}}, c = fl[[n - 1]]; While[c > 0, k++; While[MemberQ[fl, k] || GCD[k, n] > 1, k++ ]; AppendTo[r, k]; c--; ]; Append[l, r]]; Nest[f, {{1}}, 12] // Flatten (* Ray Chandler, Feb 13 2007 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Leroy Quet, Jan 08 2007
EXTENSIONS
Extended by Ray Chandler, Feb 13 2007
STATUS
approved