exhaustive enumeration and guess and check with square roots`