educative.io

Why the second parameter (i) has to be input/2?

Why can’t it be something else such as input - 1?

Hi Francis,
We use input/2 because the smallest multiple that will not make it a prime is 2. If you have checked all the numbers from 0 to n/2, what multiple is left that could possibly work? If multiple by 2 is bigger than n, then a multiple of 3 or 4 etc will also be bigger than n.