Hi,

I am trying to come up with a fast program that will check if a number is prime.

On the "isPrime() command" page on TI-BASIC developer,

it says that

"The algorithms used by the TI-89 family, TI-92 family, and Voyage 200 calculators divides by successive primes through the largest one less than 216. It does not actually keep a table or use a sieve to create these divisors, but cyclically adds the sequence of increments 2, 2, 4, 2, 4, 2, 4, 6, 2, 6 to generate these primes plus a few extra harmless composites.

TI-92 Plus and TI-89 family start the same way, except that they stop this trial division after trial divisor 1021, then switch to a relatively fast Monte-Carlo test that determines whether the number is certainly composite or is almost certainly prime. The isPrime() function stops at this point returning either false or (almost certainly) true."

I tried making my own program that does this by successive addition, but I realized that some of the prime numbers are skipped, such as 101. I would greatly appreciate it if anyone could help me out if you know what the actual sequence of numbers the program uses or if you know a better way to find primes using TI-BASIC.

Thanks