OFFSET
1,2
COMMENTS
This sequence is a derangement of the positive integers.
LINKS
Jean-Marc Falcoz, Table of n, a(n) for n = 1..10001
EXAMPLE
The sequence starts with 1,2,4,3,6,10,7,...
As all the terms of the sequence must be > 0, we cannot subtract 1 from term 1; thus a(2) is 1 (the last term) + the term a(1) = 1 + 1 = 2;
as we cannot add twice the same term, a(3) must be 2 (the last term) + a(2) = 2 + 2 = 4;
as the sequence must be the lexicographically first of its kind, and because all terms of the sequence must be different, we subtract the term a(1) = 1 from 4 (the last term) getting 3;
as we cannot subtract twice the same term, a(5) must be 3 (the last term) + the term a(4) = 3 + 3 = 6;
as the only available term for an addition to the last term a(5) is a(2) = 4, we have a(6) = 6 + 4 = 10;
as the sequence must be the lexicographically first of its kind, and because all terms of the sequence must be different, we subtract the term a(4) = 3 from 10 (the last term), getting 7;
etc.
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Eric Angelini and Jean-Marc Falcoz, Aug 26 2018
STATUS
approved