Hacker News new | past | comments | ask | show | jobs | submit login

I think you're on the right track (i.e. viewing it as a permutation, and looking at the cycle decomposition of that permutation).

Try indexing from 0 instead of 1 if you're not. Then the cycle containing 1 will start with (1, 2, 4, 8, ...). What happens when it wraps around?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: