To check that a rational number is in the Cantor set, I have written an algorithm to obtain its base-3 representation. To verify if the representation is periodic, I used a hash table in order to save memory.
Is there any easier solution to check that a rational number is in the Cantor set?