Evil numbers, the subject of Cody Problem 2733 have an even number of ones in their binary representations, whereas odious numbers, the subject of Cody Problem 2734, have an odd number of ones in their binary representations. For example, the numbers 3, 6, 10, and 12 are evil, and the numbers 2, 4, 7, and 14 are odious.
Vile numbers have binary representations that end with an even number of zeros (including zero zeros). Therefore, the numbers 3 and 12 are evil and vile, and the numbers 4 and 7 are odious and vile. The numbers 6 and 10 are evil but not vile, and the numbers 2 and 14 are odious but not vile. Got it?
Write a function to determine the nth vile number.
Solution Stats
Problem Comments
2 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers14
Suggested Problems
-
Back to basics 8 - Matrix Diagonals
970 Solvers
-
Are all the three given point in the same line?
604 Solvers
-
Construct an index vector from two input vectors in vectorized fashion
460 Solvers
-
Diophantine Equations (Inspired by Project Euler, problem 66)
70 Solvers
-
Self-similarity 3 - Every other pair of terms
58 Solvers
More from this Author323
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
A more accurate description of the problem would be binary numbers that start with an even number of zeros but not necessarily those that have or end with an even number of zeros.
If the problem were written in a language where numbers are read big-endian (e.g. Arabic), that would certainly be true.