Odious number is a nonnegative number that has an odd number of 1s in its binary expansion. The first few odious numbers are therefore 1, 2, 4, 7, 8, 11, 13, 14, 16, 19…
Given a number check if its a odious number or not.
Input : 16 Output : Odious Number Explanation: Binary expansion of 16 = 10000, having number of 1s =1 i.e odd. Input : 23 Output : Not odious number Explanation: Binary expansion of 23 is 10111, the number of 1s in this is 4 i.e even.
1) Count set bits in given number.
2) Return true if the count is odd, false otherwise.
- Count number of trailing zeros in Binary representation of a number using Bitset
- Maximize a given unsigned number number by swapping bits at it's extreme positions.
- Number of ways to split a binary number such that every part is divisible by 2
- Find a number which give minimum sum when XOR with every number of array of integers
- Check if the binary representation of a number has equal number of 0s and 1s in blocks
- Number of leading zeros in binary representation of a given number
- Minimum number of given powers of 2 required to represent a number
- Super Ugly Number (Number whose prime factors are in given set)
- Check if a number has same number of set and unset bits
- Finding number of digits in n'th Fibonacci number
- Maximum number of splits of a binary number
- Find the Number Occurring Odd Number of Times
- Number of integers with odd number of set bits
- M-th smallest number having k number of set bits.
- Check if a number is Flavius Number
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : Mithun Kumar