two functions in C and C++ solving the simple problem
new problem to learn gmp  and primes!