OFFSET
1,2
COMMENTS
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))).
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).
Better leave a(39) = 2^340282366920938463463374607431768211456 not fully evaluated.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..38
FORMULA
a(a(n)) = n.
a(n) = n iff n is in A323752.
EXAMPLE
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:
100
/ \
2 12
/ / \
1 2 1
/
1
Erase the numerical values, just keep the tree structure:
o
/ \
o o
/ / \
o o o
/
o
Take its symmetrical:
o
/ \
o o
/ \ \
o o o
\
o
Compute back new numerical values from the leafs (value: 1) up:
(2*1+1) = 3; (2^1)*(2*3+1) = 14; (2^14)*(2*3+1) = 114688
114688
/ \
14 3
/ \ \
1 3 1
\
1
So, a(100) = 114688.
MAPLE
a:= proc(n) option remember; `if`(n=0, 0, (j->
(2*a(j)+1)*2^a((n/2^j-1)/2))(padic[ordp](n, 2)))
end:
seq(a(n), n=1..38); # Alois P. Heinz, Jan 24 2019
MATHEMATICA
f[0]:=x
f[n_]:=Module[{c, k}, c=IntegerExponent[n, 2]; k=(n/2^c-1)/2; o[f[c], f[k]]])
g[x]:=0
g[o[C_, K_]]:=(2^g[C])(2g[K]+1)
r[x]:=x
r[o[C_, K_]]:=o[r[K], r[C]]
a[n_]:=g@r@f[n]
Table[a[n], {n, 1, 30}]
CROSSREFS
KEYWORD
nonn
AUTHOR
Luc Rousseau, Jan 24 2019
STATUS
approved