-1

This is in refernce to testing if a given number is prime by square root method. Qs:

  1. I understand the logic behind taking square root ( based on factor pair) but why do we consider only the prime numbers below the sq. root to test the divisibility and not all the numbers? 2). Also as any number with a square root will have that sq. root as a factor, so why cant that be considered as another factor apart from (1 and itself) ( I guess may b we consider only integers ?)
Bernard
  • 179,256
  • 2
    Sounds like you don't understand the logic then, but the link Moo posted explains. – pancini Jun 15 '21 at 18:43
  • If the number is not prime, any factor greater than the square root has to be combined with a factor smaller than the square root to obtain the number. So it suffices to check if a number smaller than the square root divides our number. – Jonas Linssen Jun 15 '21 at 18:43
  • It is interesting to know, tht any integer can be represented as a combination of primes – Sahil Bharti Jun 15 '21 at 18:57

1 Answers1

1

To show that $n$ is not prime, you want to find $x,y$ integers such $1<x<n,1<y<n$ and $xy = n$. Without loss of generality, assume $x\leq y$ (otherwise you can relabel $x$ and $y$ and $y$ as $x$), so that $$1<x \leq y < n \implies 1\cdot x <x\cdot x \leq x\cdot y = n \implies x^2\leq n \implies \sqrt x \leq n$$ So if $n$ is not prime, then it has a divisor not larger than its square root, which is why the method works.

As for your other question, if $\sqrt n$ happens to be an integer then $n$ is obviously not prime, and you would find $x=y=\sqrt n$ in the method.

Steve
  • 555