A Woodall number is of the form:
Wn = n.2n – 1
The first few Woodall numbers are: 1, 7, 23, 63, 159, 383, 895……
Given a number X. The task is to check if X is woodall number or not.
Input : X = 383 Output : Yes For n = 6, Wn = n.2n - 1 = 383. Input : X = 200 Output : No
- We can observe that all Woodall numbers are odd. So, first of all we check if given number is odd or not.
- Now to check if number is woodall or not, increment given number by 1 and now divide number by 2 until it is even and count number of times it is divisible. And at each point check if count is equal to number or not.
Below is the implementation of this approach:
This article is contributed by Anuj Chauhan. 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 write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- Count number of trailing zeros in Binary representation of a number using Bitset
- Count number of triplets with product equal to given number with duplicates allowed
- Find minimum number to be divided to make a number a perfect square
- Smallest number dividing minimum number of elements in the array | Set 2
- Smallest number dividing minimum number of elements in the Array
- Number of possible permutations when absolute difference between number of elements to the right and left are given
- Largest number dividing maximum number of elements in the array
- Number of ways to split a binary number such that every part is divisible by 2
- Given number of matches played, find number of teams in tournament
- Number of times the largest perfect square number can be subtracted from N
- Find the number of positive integers less than or equal to N that have an odd number of digits
- Count number of digits after decimal on dividing a number
- Print a number strictly less than a given number such that all its digits are distinct.
- Super Ugly Number (Number whose prime factors are in given set)
- Queries on sum of odd number digit sums of all the factors of a number
Improved By : vt_m