Why do we check up to the square root of a prime number to determine if it is prime?

前端 未结 13 1092
春和景丽
春和景丽 2020-11-22 02:24

To test whether a number is prime or not, why do we have to test whether it is divisible only up to the square root of that number?

13条回答
  •  孤城傲影
    2020-11-22 03:00

    Because if a factor is greater than the square root of n, the other factor that would multiply with it to equal n is necessarily less than the square root of n.

提交回复
热议问题