|
> You're currently using one modulo operation in the simple case, which on my
> desktop processor (older Core i5) takes longer than a division.
I guess most processors (including i5) use the same instruction to
compute a modulo and a division, so they have exactly the same cost.