login
A318452
Lexicographically first sequence of different positive terms starting with a(1) = 1, such that a(n+1) is obtained by subtracting or adding to a(n) a term already in the sequence. This term can be subtracted only once and added only once.
1
1, 2, 4, 3, 6, 10, 7, 5, 11, 16, 9, 18, 8, 15, 23, 12, 22, 13, 24, 19, 31, 25, 17, 30, 14, 28, 43, 20, 36, 21, 38, 26, 44, 27, 46, 32, 52, 33, 29, 50, 37, 59, 34, 57, 35, 60, 39, 63, 45, 71, 40, 67, 41, 69, 42, 72, 48, 77, 47, 78, 49, 81, 53, 86, 51, 85, 65, 100, 54, 90, 56, 93, 55, 94, 58, 96, 64, 104, 61, 102, 62, 105, 66
OFFSET
1,2
COMMENTS
This sequence is a derangement of the positive integers.
LINKS
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
Sequence in context: A283961 A333029 A175498 * A083673 A327120 A377837
KEYWORD
base,nonn
AUTHOR
STATUS
approved