Why do we only check up to the square root of a prime number to determine if it is prime? Can't we use cube root?

限于喜欢 提交于 2019-12-26 16:31:11

问题


If a number n can be written as axb and m=sqrt(n). Here n=m*m. We say we only need to check upto m because min(a,b)<=m. So cant we take cube roots? Suppose we take n=21, then n=1x3x7. But Cube root is 2. Why does this method fail?


回答1:


Consider n = 143 = 11 * 13. The cube root of 143 is between 5 and 6. If you only test divisibility by the primes up to 6, you will not find either of the two factors of n and will mistakenly conclude that 143 is prime.



来源:https://stackoverflow.com/questions/41530090/why-do-we-only-check-up-to-the-square-root-of-a-prime-number-to-determine-if-it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!