An integer m greater than 2, judge whether it is a prime

An integer m greater than 2, judge whether it is a prime


#include
void fun(int k)
{ int i,flag=0;
for(i=2;i



There is another problem: enter two positive integers m and n (M > = 1, n)


Scanf (% d ", & M); just add an if judgment
if(m==1) m=2;



In a right triangle, the two right sides are m, N, the hypotenuse is l, and m, N, l are positive integers, M is prime. This paper proves that 2 (M + N + 1) is a complete square number


m^2 = l^2 - n^2
=(l+n)(l-n)
Because m is a prime, L + N and L-N are powers of M, and the sum of their exponents is 2
Because l + n > L-N, it can only be:
l+n = m^2
l-n = 1
therefore
2(m+n+1) = 2m+1+(n+1)+n =2m+1+(l+n)= m^2+2m+1=(m+1)^2