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.

A323710 a(n) is the symmetrical of n via transport of structure from binary trees, where the binary tree of n is built as follows: create a root with value n and recursively apply the rule {write node's value as (2^c)*(2*k+1); if c>0, create a left child with value c; if k>0, create a right child with value k}.

This page as a plain text file.
%I A323710 #17 Jun 19 2025 09:19:15
%S A323710 1,3,2,7,8,6,4,5,128,24,256,14,64,12,16,15,32,384,
%T A323710 340282366920938463463374607431768211456,56,16777216,768,
%U A323710 115792089237316195423570985008687907853269984665640564039457584007913129639936,10,16384,192,18446744073709551616,28,4096,48
%N A323710 a(n) is the symmetrical of n via transport of structure from binary trees, where the binary tree of n is built as follows: create a root with value n and recursively apply the rule {write node's value as (2^c)*(2*k+1); if c>0, create a left child with value c; if k>0, create a right child with value k}.
%C A323710 Let f denote the bijection that maps positive integers onto binary trees, defined in the name; let g be its inverse; let r denote the symmetry on binary trees (i.e., starting from the root, r recursively swaps left and right children). By definition a(n) = g(r(f(n))).
%C A323710 If instead of r, one uses s, the operation that swaps the left and right children of the root, without recursion, then one gets g(s(f(n))) = A117303(n).
%C A323710 Better leave a(39) = 2^340282366920938463463374607431768211456 not fully evaluated.
%H A323710 Alois P. Heinz, <a href="/A323710/b323710.txt">Table of n, a(n) for n = 1..38</a>
%F A323710 a(a(n)) = n.
%F A323710 a(n) = n iff n is in A323752.
%e A323710 100 = (2^2)*(2*12+1) and recursively, 2 = (2^1), 12 = (2^2)*(2*1+1). We then have the following binary tree representation of 100:
%e A323710      100
%e A323710      / \
%e A323710     2  12
%e A323710    /   / \
%e A323710   1   2   1
%e A323710      /
%e A323710     1
%e A323710 Erase the numerical values, just keep the tree structure:
%e A323710       o
%e A323710      / \
%e A323710     o   o
%e A323710    /   / \
%e A323710   o   o   o
%e A323710      /
%e A323710     o
%e A323710 Take its symmetrical:
%e A323710       o
%e A323710      / \
%e A323710     o   o
%e A323710    / \   \
%e A323710   o   o   o
%e A323710        \
%e A323710         o
%e A323710 Compute back new numerical values from the leafs (value: 1) up:
%e A323710 (2*1+1) = 3; (2^1)*(2*3+1) = 14; (2^14)*(2*3+1) = 114688
%e A323710    114688
%e A323710      / \
%e A323710    14   3
%e A323710    / \   \
%e A323710   1   3   1
%e A323710        \
%e A323710         1
%e A323710 So, a(100) = 114688.
%p A323710 a:= proc(n) option remember; `if`(n=0, 0, (j->
%p A323710       (2*a(j)+1)*2^a((n/2^j-1)/2))(padic[ordp](n, 2)))
%p A323710     end:
%p A323710 seq(a(n), n=1..38);  # _Alois P. Heinz_, Jan 24 2019
%t A323710 f[0]:=x
%t A323710 f[n_]:=Module[{c,k},c=IntegerExponent[n,2];k=(n/2^c-1)/2;o[f[c],f[k]]]
%t A323710 g[x]:=0
%t A323710 g[o[C_,K_]]:=(2^g[C])(2g[K]+1)
%t A323710 r[x]:=x
%t A323710 r[o[C_,K_]]:=o[r[K],r[C]]
%t A323710 a[n_]:=g@r@f[n]
%t A323710 Table[a[n], {n, 1, 30}]
%Y A323710 Cf. A117303 (variant where swap left/right is not recursively applied).
%Y A323710 Cf. A323665.
%Y A323710 Cf. A323752 (fixed points of this sequence).
%K A323710 nonn
%O A323710 1,2
%A A323710 _Luc Rousseau_, Jan 24 2019