cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

Original entry on oeis.org

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

Views

Author

Rémy Sigrist, Oct 24 2019

Keywords

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.

Examples

			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).
		

Crossrefs

Cf. A326936.

Formula

A326936(n) + A326936(a(n)) = 0.