login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Bit that is two places to left of least significant 1-bit in the binary expansion of n.
2

%I #17 Apr 03 2024 15:16:59

%S 0,0,0,0,0,1,0,1,0,0,1,0,0,1,1,1,0,0,0,0,1,1,0,1,0,0,1,0,1,1,1,1,0,0,

%T 0,0,0,1,0,1,1,0,1,0,0,1,1,1,0,0,0,0,1,1,0,1,1,0,1,0,1,1,1,1,0,0,0,0,

%U 0,1,0,1,0,0,1,0,0,1,1,1,1,0,0,0,1,1,0,1,0,0,1,0,1,1,1,1,0,0,0,0,0,1,0,1,1

%N Bit that is two places to left of least significant 1-bit in the binary expansion of n.

%H Kevin Ryde, <a href="/A086483/b086483.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>

%e For n = 4, 5, 6, 7, 8 the binary expansions are 100, 101, 110, 111, 1000 and the values of a(n) are respectively 0, 1, 0, 1, 0.

%t Join[{0}, Array[BitGet[#, IntegerExponent[#, 2] + 2] &, 100]] (* _Paolo Xausa_, Apr 02 2024 *)

%o (PARI) a(n) = bittest(n, if(n,valuation(n,2)+2)); \\ _Kevin Ryde_, Apr 07 2022

%Y Cf. A038189.

%K nonn,easy

%O 0,1

%A _N. J. A. Sloane_, Dec 22 2003

%E Corrected and extended by Douglas Gaut (dgaut(AT)ashland.edu), Apr 12 2004