login
For any nonnegative integer n with binary expansion Sum_{i >= 0} b_i * 2^i, the binary expansion of a(n) is Sum_{i >= 0} c_i * 2^i with c_i = (Sum_{k > 0} b_{k*(i+1)-1}) mod 2 for any i >= 0.
3

%I #14 Apr 17 2024 04:14:19

%S 0,1,3,2,5,4,6,7,11,10,8,9,14,15,13,12,17,16,18,19,20,21,23,22,26,27,

%T 25,24,31,30,28,29,39,38,36,37,34,35,33,32,44,45,47,46,41,40,42,43,54,

%U 55,53,52,51,50,48,49,61,60,62,63,56,57,59,58,65,64,66,67

%N For any nonnegative integer n with binary expansion Sum_{i >= 0} b_i * 2^i, the binary expansion of a(n) is Sum_{i >= 0} c_i * 2^i with c_i = (Sum_{k > 0} b_{k*(i+1)-1}) mod 2 for any i >= 0.

%C This sequence is a permutation of the nonnegative integers with inverse A371977.

%H Rémy Sigrist, <a href="/A371976/b371976.txt">Table of n, a(n) for n = 0..8191</a>

%H Rémy Sigrist, <a href="/A371976/a371976.png">Scatterplot of (n, a(n)-n) for n < 2^20</a>

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

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

%F a(n) mod 2 = A010060(n).

%e For n = 42: the binary expansion of 42 is "101010":

%e b_5 b_4 b_3 b_2 b_1 b_0

%e 1 0 1 0 1 0

%e c_5 = 1 = 1 mod 2

%e c_4 = 0 = 0 mod 2

%e c_3 = 1 = 1 mod 2

%e c_2 = 1 + 0 = 1 mod 2

%e c_1 = 1 + 1 + 1 = 1 mod 2

%e c_0 = 1 + 0 + 1 + 0 + 1 + 0 = 1 mod 2

%e - so the binary expansion of a(42) is "101111", and a(42) = 47.

%o (PARI) a(n) = { my (b = Vecrev(binary(n)), c = vector(#b)); for (i = 1, #b, forstep (k = i, #b, i, c[i] += b[k];);); fromdigits(Vecrev(c) % 2, 2); }

%Y See A371974 for a similar sequence.

%Y Cf. A010060, A070939, A371977 (inverse).

%K nonn

%O 0,3

%A _Rémy Sigrist_, Apr 14 2024