I'm working on a program that determines if a number is prime or not.
This involves dividing this number by all numbers smaller than it. But because we are dealing with very large numbers. Dividing it with too many numbers isn't a good idea . So I need a way to minimize the effort done by the program.
Lets assume the number is called $n$. My approach is to divide it by all numbers less than $\frac{n}{2}$.(rounded to the nearest integer) Is there anything wrong with it? And if there is a simpler way please point me to it.