Quote Originally Posted by TriLogic View Post
The problem with checking numbers with terminating digits of 1,3,7 and 9 is that they will include multiples of 3 such as 9,(15),21, 27, 33, 39,...,just keep adding 6 to these numbers and the pattern repeats.(includes terminating digit 5) as 1,7,3,9,5,1,7,3,9,5,...,None of these numbers in this sequence towards infinity are prime.

Calculating Digital Roots is a method of summing individual digits of any number to a single digit number between 1 and 9.

9 = 9
21 = 2 + 1 = 3
27 = 2 + 7 = 9
33 = 3 + 3 = 6
39 = 3 + 9 = 12 = 1 + 2 = 3

31 = 3 + 1 = 4
37 = 3 + 7 = 10 = 1
43 = 4 + 3 = 7



Any numbers with Digital Root of 3, 6 or 9 will not be a prime number. So calculating digital roots is useful method of 'rooting out' odd numbers which terminate with 1,3,7,9, that have digital roots of 1,4,7 and 2,5,8 but not 3,6 or 9.
I just got up from a nap and looked at this again and it makes perfect sense:

2 = 2
3 = 3
5 = 5
7 = 2
11 = 1 + 1 = 2
13 = 1 + 3 = 4
17 = 1 + 7 = 8
19 = 1 + 9 = 10 = 1 + 0 = 1
23 = 2 + 3 = 5
29 = 2 + 9 = 11 = 1 + 1 = 2

Those above are a small handful of little primes. It's a continual adding of digits until you have only one digit:

102 breaks up into 1 + 0 + 2. Add that and you get 3.

Amazing and simple. Implementation into code may be tough. I'll try it with VB6 first.