login
For any positive integer with binary digits (b_1, ..., b_w) (where b_1 = 1), the binary digits of a(n), possibly with leading zeros, are (b_2, b_4, ..., b_{floor(w/2) * 2}); a(0) = 0.
3

%I #23 Mar 28 2024 18:04:05

%S 0,0,0,1,0,0,1,1,0,1,0,1,2,3,2,3,0,0,1,1,0,0,1,1,2,2,3,3,2,2,3,3,0,1,

%T 0,1,2,3,2,3,0,1,0,1,2,3,2,3,4,5,4,5,6,7,6,7,4,5,4,5,6,7,6,7,0,0,1,1,

%U 0,0,1,1,2,2,3,3,2,2,3,3,0,0,1,1,0,0,1

%N For any positive integer with binary digits (b_1, ..., b_w) (where b_1 = 1), the binary digits of a(n), possibly with leading zeros, are (b_2, b_4, ..., b_{floor(w/2) * 2}); a(0) = 0.

%C In other words, we keep even-indexed bits.

%C Every integer appears infinitely many times in the sequence.

%H Rémy Sigrist, <a href="/A371459/b371459.txt">Table of n, a(n) for n = 0..8192</a>

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

%F a(n) = 0 iff n belongs to A126684.

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

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

%e The first terms, in decimal and in binary, are:

%e n a(n) bin(n) bin(a(n))

%e -- ---- ------ ---------

%e 0 0 0 0

%e 1 0 1 0

%e 2 0 10 0

%e 3 1 11 1

%e 4 0 100 0

%e 5 0 101 0

%e 6 1 110 1

%e 7 1 111 1

%e 8 0 1000 0

%e 9 1 1001 1

%e 10 0 1010 0

%e 11 1 1011 1

%e 12 2 1100 10

%e 13 3 1101 11

%e 14 2 1110 10

%e 15 3 1111 11

%e 16 0 10000 0

%t A371459[n_] := FromDigits[IntegerDigits[n, 2][[2;;-1;;2]], 2];

%t Array[A371459, 100, 0] (* _Paolo Xausa_, Mar 28 2024 *)

%o (PARI) a(n) = { my (b = binary(n)); fromdigits(vector(#b\2, k, b[2*k]), 2); }

%o (Python)

%o def A371459(n): return int(bin(n)[3::2],2) if n>1 else 0 # _Chai Wah Wu_, Mar 27 2024

%Y See A371442 for the sequence related to odd-indexed bits.

%Y See A059906 and A063695 for similar sequences.

%Y Cf. A000695, A001196, A126684.

%K nonn,base,easy

%O 0,13

%A _Rémy Sigrist_, Mar 24 2024