Added a helper method: calculateSquare()

The helper method lightens calculatePrimes