on-internet
← Community

Get n-th bit of an integer

Stack Overflow ·

I am given a large integer a, and a (relatively small) integer n. What is the fastest way to get the nth bit (with the least significant bit being 0) of the binary representation of a using native Python?

Comments

Sign in or sign up to comment and upvote.

No comments yet.