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.

A361198 Consider a perfect infinite binary tree with nodes labeled with distinct positive integers where n appears at level A082850(n) and each level is filled from left to right; a(n) is the sibling of n in this tree.

This page as a plain text file.
%I A361198 #19 Mar 03 2025 09:32:55
%S A361198 2,1,6,5,4,3,14,9,8,13,12,11,10,7,30,17,16,21,20,19,18,29,24,23,28,27,
%T A361198 26,25,22,15,62,33,32,37,36,35,34,45,40,39,44,43,42,41,38,61,48,47,52,
%U A361198 51,50,49,60,55,54,59,58,57,56,53,46,31,126,65,64,69,68
%N A361198 Consider a perfect infinite binary tree with nodes labeled with distinct positive integers where n appears at level A082850(n) and each level is filled from left to right; a(n) is the sibling of n in this tree.
%C A361198 This sequence is a self-inverse permutation of the positive integers with no fixed point.
%C A361198 We can build a similar tree from any sequence of positive integers where each value appears infinitely many times. The choice of A082850 is interesting as each parent node appears immediately after its second child; also, for each pair of nodes of the same level, say p and p', and each pair of nodes, c and c', where c has ancestor p and c' has ancestor p', and the relative position of p with respect to c is the same as for p' with respect to c', we have p - c = p' - c'.
%C A361198 Empirically: to compute a(n): replace the least significant nonzero digit in the skew-binary expansion of n, say d, by 3-d. - _Rémy Sigrist_, Mar 02 2025
%H A361198 Rémy Sigrist, <a href="/A361198/b361198.txt">Table of n, a(n) for n = 1..8190</a>
%H A361198 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A361198 a(A101925(2*n)) = A101925(2*n + 1).
%F A361198 a(A101925(2*n + 1)) = A101925(2*n).
%F A361198 A082850(a(n)) = A082850(n).
%F A361198 a(2^k - 1) = 2^(k+1) - 2 for any k > 0.
%F A361198 abs(a(n) - n) = 2^A082850(n) - 1 (belongs to A126646).
%F A361198 Apparently, a(n) < n iff A308187(n+1) = 1.
%e A361198 The perfect infinite binary tree starts as follows:
%e A361198                                  31
%e A361198                   ---------------------------------
%e A361198                  15                              30
%e A361198           -----------------               -----------------
%e A361198           7              14              22              29
%e A361198       ---------       ---------       ---------       ---------
%e A361198       3       6      10      13      18      21      25      28
%e A361198     -----   -----   -----   -----   -----   -----   -----   -----
%e A361198     1   2   4   5   8   9  11  12  16  17  19  20  23  24  26  27
%e A361198 .
%e A361198 So a(1) = 2 and a(2) = 1, a(4) = 5 and a(5) = 4, etc.,
%e A361198    a(3) = 6 and a(6) = 3, a(10) = 13 and a(13) = 10, etc.,
%e A361198    a(7) = 14 and a(14) = 7, a(22) = 29 and a(29) = 22,
%e A361198    a(15) = 30 and a(30) = 15.
%o A361198 (PARI) a(n) = { my (n0 = n); for (h = 2, oo, if (n < 2^h-1, while (1, my (w=2^h-- - 1); if (n == w, return (n0 - n + 2*w), n == 2*w, return (n0 - n + w), n > w, n -= w)))) }
%Y A361198 Cf. A082850, A101925, A126646, A308187.
%K A361198 nonn
%O A361198 1,1
%A A361198 _Rémy Sigrist_, Mar 04 2023