fix a bug when the number of ranks is a prime number

Signed-off-by: Sébastien Boisvert <sebastien.boisvert.3@ulaval.ca>