OFFSET
1,2
COMMENTS
A permutation of positive integers.
Alternative construction: start with the infinite sequence of all 1s, at step n look up the value of the term at n'th place (k), and if it has been used before, find the smallest unused multiple of k (m*k), find all occurrences of k in the sequence (there are going to be infinitely many), and change every second of them to m*k (see Example).
LINKS
Ivan Neretin, Table of n, a(n) for n = 1..10000
EXAMPLE
Start with
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
At step 1, do nothing.
At step 2, change every second 1 to 2.
2: 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2
At step 3, change every other remaining 1 to 3.
3: 1 2 3 2 1 2 3 2 1 2 3 2 1 2 3 2
At step 4, change every other 2 to 4.
4: 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4
And so on.
5: 1 2 3 4 5 2 3 4 1 2 3 4 5 2 3 4
6: 1 2 3 4 5 6 3 4 1 2 3 4 5 6 3 4
7: 1 2 3 4 5 6 9 4 1 2 3 4 5 6 9 4
8: 1 2 3 4 5 6 9 8 1 2 3 4 5 6 9 8
9: 1 2 3 4 5 6 9 8 7 2 3 4 5 6 9 8
...
MATHEMATICA
Fold[Append[#1, Min@Complement[Range[Max@#1 + 1]*#1[[#2 - 2^Floor@Log2[#2 - 1]]], #1]] &, {1}, Range[2, 65]] (* Ivan Neretin, Mar 06 2016 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Ivan Neretin, Mar 06 2016
STATUS
approved