Mersenne Primes Generator in C#
Bug

This line seems wrong:


double result1 = (Math.Pow(2, exp1) % i)*C;



It seems like you are implying that:

\$x^y \mod m = ((x \mod m)*y) \mod m\$

But I believe the actual relationship is:

\$x^y \mod m = (x \mod m)^y \mod m\$

This probably explains why your program thinks the known Mersenne prime is divisible by 7.

Loop termination, or lack of it

Your loop is like this:


for (long i = 3; i &lt;= (big/i); i+=2)//***comment below



But big is \$2^{74207281} - 1\$.  Therefore, you intend your loop to run until i reaches \$\sqrt {2^{74207281}-1}\$, meaning i needs to reach about \$2^{37103640}\$.  Unfortunately, your loop index is a long and not a BigInteger, so it can't even represent the numbers you need to represent.  But even if you made i a BigInteger, the loop would run virtually forever because you would need to reach that huge number before you could stop.