How can I make a program that checks if binary representation of a given integer is periodical with period length m >= 2?
For example:
Binary representation of 10 is periodical
10 base 10 = 1010 base 2, periodical with period length 2
Binary representation of 9 is not periodical
9 base 10 = 1001 base 2
Binary representation of 153 is periodical
153 base 10 = 10011001 base 2, periodical with period length 4
Is there any specific algorithm for doing this?
I am working in C++.