Finding if a number is prime by looking at the sum of their digits Take a number $N = \overline{abcdef...}$ where $a, b, c, d,e,\dots$ are the digits of $N$. 
Let $k$ be the sum of those digits :
$a+b+c+d+e+... = k$
If $k$ is any of  ${1, 2, 4, 5, 7, 8 }$ then $N$ is prime. Otherwise it is not a prime.
Example: $N = 17$ and $k = 1+ 7 = 8,$ Therefore $N$ is prime.
Now, I want to know the following:
1) Is my guess is correct, and if so how can I prove it mathematically ?
2) If I am wrong, where I am wrong ?
Regards-Gandhi,
Thanks!
 A: Any number is congruent with the sum of its digits modulo 9.
Therefore, if the sum of the digits is 3,6 or 0 $\pmod{9}$ the number is divisible by $3$. And in this case, the number is either $3$ or composite.
If the sum of the digits is $1,2,4,5,7,8 \pmod{9}$ the number could be prime. 
There are infinitely many numbers of this form which are not prime, and Dirichlet Theorem tells us that there are also infinitely many numbers of this form which are prime.
A: The digit sum operation you describe is invariant modulo 9.
The 5-digit number $abcde = a 10^4 + b 10^3 + c 10^2 + d 10 + e$.  Since $10 = 9 + 1 \equiv 1 \mod 9$, you can see that $abcde \equiv a + b + c + d + e \mod 9$.
So if a number's digit sum is divisible by 3 that means the number itself is also divisible by 3.  No primes (other than 3) are divisible by 3.  So you have a way to prove a number is not prime, but not a way to prove that it is prime.
A: Asymptotically, the fraction of all numbers which are composite is 1, and your method predicts 1/3. This means it's wrong asymptotically about 2/3 of the time.
Up to 10^25, there are 176846309399143769411680 primes. Your method predicts that 1 of these is composite and the rest are prime. There are also 9823153690600856230588319 composites up to 10^25. Of these it predicts that 3333333333333333333333332 are composite and 6489820357267522897254987 are prime, for a total of 3510179642732477102745012 or about 35% correct.
A: 
This is a simple flow chart to show the break down of all the most possible answers adding to 8 will bring. 
A prime, a number divisible by a prime*, a number divisible by 7. If divisible by 7 then, quotient will be divisible by 7 or by a prime. All possible answers may repeat till essentially infinity.
This will continue until the number is divisible by a prime.
(7^n will never have digits adding to 8 so it will never end with obtaining 7)
*By prime I mean a prime greater than 7.
