You keep saying "calculating 2^{some 5digit number}". What calculation are you doing?
You don't need the decimal expansion to decide if it is prime. You also don't need to write your own software. So, what is it you want to do?
I feel like you intend to find some primes, and then write (to disk? To screen? both?) out the decimal expansions of those primes.
But you aren't even telling us what numbers you are checking. 2^50000 is obviously not prime; do you mean 2^50000 1, or 2^50000 +1, or something else entirely?
You mentioned fermat and mersenne primes those have been checked to quite large values, and software is easily available if you wish to contribute to those searches. Why start over from scratch, which gives you no chance whatsoever to discover something previously unknown?
