|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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.
|
|
LINKS
|
|
|
FORMULA
|
|
|
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
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|