login
A328654
Consider an empty list L, and for k = 1, 2, ...: if L contains a pair of consecutive terms summing to k, then let (u, v) be the first such pair: replace the two terms u and v in L with a single term k and set a(u) = v and a(v) = u, otherwise append k to L.
3
2, 1, 4, 3, 6, 5, 11, 9, 8, 12, 7, 10, 14, 13, 16, 15, 18, 17, 20, 19, 23, 27, 21, 44, 26, 25, 22, 29, 28, 32, 39, 30, 34, 33, 49, 37, 36, 40, 31, 38, 42, 41, 45, 24, 43, 47, 46, 50, 35, 48, 57, 53, 52, 55, 54, 58, 51, 56, 60, 59, 63, 67, 61, 124, 66, 65, 62
OFFSET
1,1
COMMENTS
For any n > 0, a(n) is the value of the sibling of the node with value n in the binary tree described in A326936.
This sequence is a self-inverse permutation of the positive integers.
FORMULA
A326936(n) + A326936(a(n)) = 0.
EXAMPLE
For n = 1:
- we set L = (1).
For n = 2:
- we set L = (1, 2).
For k = 3:
- the first two terms, (1, 2), sum to 3,
- so a(1) = 2 and a(2) = 1,
- we set L = (3).
PROG
(C++) See Links section.
CROSSREFS
Cf. A326936.
Sequence in context: A306230 A071065 A359946 * A035552 A339372 A352111
KEYWORD
nonn
AUTHOR
Rémy Sigrist, Oct 24 2019
STATUS
approved