Odious Numbers
An odious
number is a nonnegative number that has an odd number of 1s in its
binary representation. The first few odious numbers are therefore 1,
2, 4, 7, 8, 11, 13, 14, 16, 19… Numbers that are not odious are
said to be evil numbers. Problem
Decide
which numbers, in a given closed interval, are odious numbers, and
find all pairs of consecutive numbers (n,n+1), where n is both an
odious and an odd number and n+1 is both an evil and an even number:
(odious_odd,evil_even).
Input
The input has one
line containing two positive integers between 1 and 10000 each,
separated by a space; the first integer – L – is the low limit of
the closed interval; the second one – H – is the high limit. Output The output is composed of the pairs of consecutive numbers oe(odious_odd,evil_even) and the set of odious numbers in the form o{o1,o2,o3…} that lie in the interval [L,H].
There
must be a line for each pair oe(odious_odd,evil_even) and a final
line with the set of odious numbers. In the absence of resulting
pairs, no line is written for the pairs. In the absence of resulting
odious numbers, the last line contains the empty set o{}. Sample Input 1 1 20
Sample Output 1 oe(11,12)
oe(19,20)
o{1,2,4,7,8,11,13,14,16,19}
Sample Input 2 3 3
Sample Output 2 o{}
