login
Replace 2^k in binary expansion of n with 2^(2^k).
2

%I #70 Dec 31 2023 00:26:24

%S 0,2,4,6,16,18,20,22,256,258,260,262,272,274,276,278,65536,65538,

%T 65540,65542,65552,65554,65556,65558,65792,65794,65796,65798,65808,

%U 65810,65812,65814,4294967296,4294967298,4294967300

%N Replace 2^k in binary expansion of n with 2^(2^k).

%C Sums of distinct terms of A001146.

%C The name "ballooned integers" is proposed for this sequence.

%C a(n) is the index of the first occurrence of n in A253315.

%H Tilman Piesk, <a href="/A358126/b358126.txt">Table of n, a(n) for n = 0..4095</a>

%H Tilman Piesk, <a href="https://commons.wikimedia.org/wiki/File:3-ary_linear_to_noble,_even.svg">Boolean Walsh functions and corresponding balloons</a>

%H Tilman Piesk, <a href="https://commons.wikimedia.org/wiki/File:Variadic_logical_connectives_with_up_to_5_arguments;_XOR_twin.svg">First 32 entries in little-endian binary</a>

%F If n = Sum_{i=0..k} 2^s_i, then a(n) = Sum_{i=0..k} 2^(2^s_i).

%F a(n) = 2 * A253317(n+1).

%F a(2^n-1) = A060803(n-1) for n >= 1.

%F a(2^n) = A001146(n).

%F A197819[m, a(n)] = A228539[m, n]. (Compare link about Boolean Walsh functions.)

%e Let n = 25 = 1 + 8 + 16 = 2^0 + 2^3 + 2^4.

%e Then a(n) = 65794 = 2 + 256 + 65536 = 2^(2^0) + 2^(2^3) + 2^(2^4).

%e The binary indices of n are {0, 3, 4}. Those of a(n) are {1, 8, 16}.

%p a := proc(n) select(d -> d[2] <> 0, ListTools:-Enumerate(convert(n,base,2))):

%p add(2^(2^(%[j][1] - 1)), j = 1..nops(%)) end: seq(a(n), n = 0..34); # _Peter Luschny_, Oct 31 2022

%t a[n_] := Total[2^(2^Range[If[n == 0, 1, IntegerLength[n,2]] - 1, 0, -1]) * IntegerDigits[n, 2]]; Array[a, 35, 0] (* _Amiram Eldar_, Oct 31 2022 *)

%o (Python)

%o def a(n):

%o binary_string = "{0:b}".format(n)[::-1] # little-endian

%o result = 0

%o for i, binary_digit in enumerate(binary_string):

%o if binary_digit == '1':

%o result += 1 << (1 << i) # 2 ** (2 ** i)

%o return result

%o (PARI) a(n) = my(d=Vecrev(digits(n,2))); for (k=1, #d, d[k] *= 2^(2^(k-1))); vecsum(d); \\ _Michel Marcus_, Oct 31 2022

%Y Cf. A253317, A001146, A060803, A133457, A197819, A228539, A253315.

%K nonn,base

%O 0,2

%A _Tilman Piesk_, Oct 30 2022