login
A358126
Replace 2^k in binary expansion of n with 2^(2^k).
2
0, 2, 4, 6, 16, 18, 20, 22, 256, 258, 260, 262, 272, 274, 276, 278, 65536, 65538, 65540, 65542, 65552, 65554, 65556, 65558, 65792, 65794, 65796, 65798, 65808, 65810, 65812, 65814, 4294967296, 4294967298, 4294967300
OFFSET
0,2
COMMENTS
Sums of distinct terms of A001146.
The name "ballooned integers" is proposed for this sequence.
a(n) is the index of the first occurrence of n in A253315.
FORMULA
If n = Sum_{i=0..k} 2^s_i, then a(n) = Sum_{i=0..k} 2^(2^s_i).
a(n) = 2 * A253317(n+1).
a(2^n-1) = A060803(n-1) for n >= 1.
a(2^n) = A001146(n).
A197819[m, a(n)] = A228539[m, n]. (Compare link about Boolean Walsh functions.)
EXAMPLE
Let n = 25 = 1 + 8 + 16 = 2^0 + 2^3 + 2^4.
Then a(n) = 65794 = 2 + 256 + 65536 = 2^(2^0) + 2^(2^3) + 2^(2^4).
The binary indices of n are {0, 3, 4}. Those of a(n) are {1, 8, 16}.
MAPLE
a := proc(n) select(d -> d[2] <> 0, ListTools:-Enumerate(convert(n, base, 2))):
add(2^(2^(%[j][1] - 1)), j = 1..nops(%)) end: seq(a(n), n = 0..34); # Peter Luschny, Oct 31 2022
MATHEMATICA
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 *)
PROG
(Python)
def a(n):
binary_string = "{0:b}".format(n)[::-1] # little-endian
result = 0
for i, binary_digit in enumerate(binary_string):
if binary_digit == '1':
result += 1 << (1 << i) # 2 ** (2 ** i)
return result
(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
KEYWORD
nonn,base
AUTHOR
Tilman Piesk, Oct 30 2022
STATUS
approved