I've read a few articles about how several researchers have tested large ranges of prime numbers and I am interested on how they are doing this.

1) Does anyone have the software equation used to test prime numbers? In C++,xBase or Visual basic would be useful.

2) How is the result used to determine that it is in the correct range? I'm looking for a simple description if possible.

3) What happens if non-prime numbers are plugged into this equation and they give results that mirror the results of prime numbers? Would that invalidate the equation?