Fixed the calculation for a prime number.