%I #12 Feb 27 2020 23:17:54
%S 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,
%T 22,29,28,32,39,30,34,33,49,37,36,40,31,38,42,41,45,24,43,47,46,50,35,
%U 48,57,53,52,55,54,58,51,56,60,59,63,67,61,124,66,65,62
%N 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.
%C 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.
%C This sequence is a self-inverse permutation of the positive integers.
%H Rémy Sigrist, <a href="/A328654/b328654.txt">Table of n, a(n) for n = 1..10000</a>
%H Rémy Sigrist, <a href="/A328654/a328654.txt">C++ program for A328654</a>
%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A326936(n) + A326936(a(n)) = 0.
%e For n = 1:
%e - we set L = (1).
%e For n = 2:
%e - we set L = (1, 2).
%e For k = 3:
%e - the first two terms, (1, 2), sum to 3,
%e - so a(1) = 2 and a(2) = 1,
%e - we set L = (3).
%o (C++) See Links section.
%Y Cf. A326936.
%K nonn
%O 1,1
%A _Rémy Sigrist_, Oct 24 2019
|