Trivial Case 1
will be represented using for all base .
Trivial Case 2
is represented as in base -2. For other bases, it will be .
For base , the number will be represented as .
For any number , it can be represented using s in base . The representation will be .
It is guaranteed that the number of bits in the lucky numbers will not exceed the number of bits in .
Avoid duplicates (Same numbers represented using only 1s in more than 2 bases).
Key Idea: For any number can be represented using only 1s in base , then will be lucky.
Generate strings of length etc. containing only 1s and figure out their values in base-2, 3, … considering the limits discussed above.
All the generated values will be lucky numbers.