Problem 53880. List the vile numbers
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
Rafael S.T. Vieira
on 26 Nov 2022
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.
GeeTwo
on 30 Dec 2022
If the problem were written in a language where numbers are read big-endian (e.g. Arabic), that would certainly be true.
Solution Comments
Show commentsGroup

Sequences & Series V
- 16 Problems
- 5 Finishers
- Solve a nonlinear difference equation
- Iterate the sum of divisors and totient
- Sum the elements in rows of the Levine triangle
- Find the smallest integer m such that n divides m!
- Identify Ruth-Aaron numbers
- Find numbers in the Popular Computing Z-sequence
- Find the nth nude number
- Determine whether a number is a fibodiv number
- List modest numbers up to n
- List the vile numbers
- List the dopey numbers
- Compute the Sequence of the Day
- Classify product/digit-sum sequences
- Count unique orderings of vertices of a polygon
- Count the ways to draw non-intersecting chords between points on a circle
- Fill a rectangle with 1x1 and 2x2 tiles
Problem Recent Solvers10
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!