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.
- 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
- Super Ugly Number (Number whose prime factors are in given set)
- Number of leading zeros in binary representation of a given number
- Minimum number of given powers of 2 required to represent a number
- Find the Number Occurring Odd Number of Times
- Finding number of digits in n'th Fibonacci number
- Check if a number has same number of set and unset bits
- Number of integers with odd number of set bits
- Check if a number is an Achilles number or not
- M-th smallest number having k number of set bits.
- Check if a number is Flavius Number
- Find third number such that sum of all three number becomes prime
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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