A358126 Replace 2^k in binary expansion of n with 2^(2^k).
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
Examples
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}.
Links
- Tilman Piesk, Table of n, a(n) for n = 0..4095
- Tilman Piesk, Boolean Walsh functions and corresponding balloons
- Tilman Piesk, First 32 entries in little-endian binary
Programs
-
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 *)
-
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
-
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
Comments