login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A309577 Table read by rows: T(n, k) is n with the first k bits removed from its binary expansion and then converted back to decimal, for 0 <= k <= A070939(n). 2

%I #22 Oct 08 2019 17:12:40

%S 1,0,2,0,0,3,1,0,4,0,0,0,5,1,1,0,6,2,0,0,7,3,1,0,8,0,0,0,0,9,1,1,1,0,

%T 10,2,2,0,0,11,3,3,1,0,12,4,0,0,0,13,5,1,1,0,14,6,2,0,0,15,7,3,1,0,16,

%U 0,0,0,0,0,17,1,1,1,1,0,18,2,2,2,0,0,19

%N Table read by rows: T(n, k) is n with the first k bits removed from its binary expansion and then converted back to decimal, for 0 <= k <= A070939(n).

%H Peter Kagey, <a href="/A309577/b309577.txt">Table of n, a(n) for n = 1..9987</a> (first 1000 rows)

%F T(n,0) = n and T(n, A070939(n)) = 0.

%e For n = 26 and k = 2, T(26, 2) = 2 because 26 = 11010_2, and removing the first two bits leaves 010_2 = 2.

%e Table begins:

%e n\k| 0 1 2 3 4

%e ---+-----------

%e 1 | 1 0

%e 2 | 2 0 0

%e 3 | 3 1 0

%e 4 | 4 0 0 0

%e 5 | 5 1 1 0

%e 6 | 6 2 0 0

%e 7 | 7 3 1 0

%e 8 | 8 0 0 0 0

%e 9 | 9 1 1 1 0

%t T[n_, k_] := BitAnd[n, 2^k-1]; Table[T[n, k], {n, 1, 20}, {k, BitLength[n], 0, -1}] // Flatten (* _Amiram Eldar_, Aug 09 2019 *)

%o (Ruby)

%o def t(n,k); n & (1 << n.bit_length - k) - 1 end

%Y Cf. A070939, A309576.

%K nonn,tabf,base

%O 1,3

%A _Peter Kagey_, Aug 08 2019

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 20 10:14 EDT 2024. Contains 371813 sequences. (Running on oeis4.)