I was going through the basics of trial division primality test, and hence, implementing it in code. The performance of the algorithm can be increased using many tricks like:
1) running the trial division only up to square-root(n)
2) trading memory for time by creating a sieve up to square-root(n), and then running the trial division only on the primes in the created sieve
But nowhere did I find the idea of returning the result as composite if the value of n%6
(n mod 6) if found out to be 1 or 5
(using the 6k +/- 1 rule). Will using this rule in our prime number determination test not improve its performance? If yes, why hasn't it been mentioned anywhere? If no, why is it so?
Thanks.