Editorial for Lucky Number Seven

Trivial Case 1
11 will be represented using 11 for all base b2b \geq 2.

Trivial Case 2
22 is represented as 1010 in base -2. For other bases, it will be 22.

Hint 1
For base bXb \geq X, the number will be represented as XX.

Hint 2
For any number X(>3)X (>3), it can be represented using 11s in base b=X1b = X - 1. The representation will be 1111.

Hint 3
It is guaranteed that the number of bits in the lucky numbers will not exceed the number of bits in NN.

Hint 4
Avoid duplicates (Same numbers represented using only 1s in more than 2 bases).

Solution
Key Idea: For any numberX3X \geq 3 can be represented using only 1s in base 2b<X12 \leq b < X - 1, then XX will be lucky.
Generate strings of length 3,4,5,,3, 4, 5, \dots, 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.

Statistics


63% Solution Ratio

UshanGhoshEarliest, 5M ago

fakhrulsojibFastest, 0.0s

fakhrulsojibLightest, 131 kB

MatrixShortest, 204B

Toph uses cookies. By continuing you agree to our Cookie Policy.