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

From memory you don't need size to be a prime, what you need is that it is coprime with your step.

Thus, the easiest solution is to take a step-size that is prime and different from you size (that works for any size). Given the index of the current element, the next index would be `(current_index + step) % size`.




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

Search: