To test if a number is prime you only need to check divisors up to (and including) the square root of the number. And you can test for divisibility by 2 separately and then test only odd divisors.

And you don't need to use the pow function.

You really need to be careful about numeric overflow with this algorithm.

Code:

#include <stdio.h>
#include <stdbool.h>
#include <inttypes.h>
typedef int64_t INT;
#define FORMAT PRId64
#define HIGH_N 10000000000
bool isprime(INT n);
int main(void) {
INT n, power = 4;
for (;;) {
if (isprime(power - 1)) {
n = power / 2 * (power - 1);
if (n > 10000000000)
break;
else
printf("%" FORMAT "\n", n);
}
power *= 2;
}
return 0;
}
bool isprime(INT n) {
if (n % 2 == 0)
return n == 2;
for (INT i = 3; i * i <= n; i += 2)
if (n % i == 0)
return false;
return true;
}