login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

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}.
3

%I #13 Jan 27 2019 17:56:44

%S 1,3,2,7,8,6,4,5,128,24,256,14,64,12,16,15,32,384,

%T 340282366920938463463374607431768211456,56,16777216,768,

%U 115792089237316195423570985008687907853269984665640564039457584007913129639936,10,16384,192,18446744073709551616,28,4096,48

%N 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 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 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 Better leave a(39) = 2^340282366920938463463374607431768211456 not fully evaluated.

%H Alois P. Heinz, <a href="/A323710/b323710.txt">Table of n, a(n) for n = 1..38</a>

%F a(a(n)) = n.

%F a(n) = n iff n is in A323752.

%e 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 100

%e / \

%e 2 12

%e / / \

%e 1 2 1

%e /

%e 1

%e Erase the numerical values, just keep the tree structure:

%e o

%e / \

%e o o

%e / / \

%e o o o

%e /

%e o

%e Take its symmetrical:

%e o

%e / \

%e o o

%e / \ \

%e o o o

%e \

%e o

%e Compute back new numerical values from the leafs (value: 1) up:

%e (2*1+1) = 3; (2^1)*(2*3+1) = 14; (2^14)*(2*3+1) = 114688

%e 114688

%e / \

%e 14 3

%e / \ \

%e 1 3 1

%e \

%e 1

%e So, a(100) = 114688.

%p a:= proc(n) option remember; `if`(n=0, 0, (j->

%p (2*a(j)+1)*2^a((n/2^j-1)/2))(padic[ordp](n, 2)))

%p end:

%p seq(a(n), n=1..38); # _Alois P. Heinz_, Jan 24 2019

%t f[0]:=x

%t f[n_]:=Module[{c,k},c=IntegerExponent[n,2];k=(n/2^c-1)/2;o[f[c],f[k]]])

%t g[x]:=0

%t g[o[C_,K_]]:=(2^g[C])(2g[K]+1)

%t r[x]:=x

%t r[o[C_,K_]]:=o[r[K],r[C]]

%t a[n_]:=g@r@f[n]

%t Table[a[n], {n, 1, 30}]

%Y Cf. A117303 (variant where swap left/right is not recursively applied).

%Y Cf. A323665.

%Y Cf. A323752 (fixed points of this sequence).

%K nonn

%O 1,2

%A _Luc Rousseau_, Jan 24 2019