Find 10 large prime numbers with n digits You are given n (200 &le; n &lt; 250) as a command line argument. Print 10 prime numbers with n digits. Your program should run under 1s and must be shorter than 5000 bytes (excluding). 

Sum the digits of all your 500 primes. Program with the largest sum wins.

An example (more here):

$ ./find_large_primes 200
58021664585639791181184025950440248398226136069516938232493687505822471836536824298822733710342250697739996825938232641940670857624514103125986134050997697160127301547995788468137887651823707102007839
29072553456409183479268752003825253455672839222789445223234915115682921921621182714164684048719891059149763352939888629001652768286998932224000980861127751097886364432307005283784155195197202827350411
41184172451867371867686906412307989908388177848827102865167949679167771021417488428983978626721272105583120243720400358313998904049755363682307706550788498535402989510396285940007396534556364659633739
54661163828798316406139641599131347203445399912295442826728168170210404446004717881354193865401223990331513412680314853190460368937597393179445867548835085746203514200061810259071519181681661892618329
71611195866368241734230315014260885890178941731009368469658803702463720956633120935294831101757574996161931982864195542669330457046568876289241536680683601749507786059442920003278263334056542642264651
28591045597720075832628274729885724490653298360003309382769144463123258670807750560985604954275365591715208615509779345682419533206637382048824349415329839450792353652240682445321955199147316594996133
49790921912819110019003521637763748399072771256062128988437189616228355821145834783451215869998723492323628198577054239101181556609916127864608488018093426129641387774385490891035446702272744866010729
15474811206486587193258690501682404626361341756658894201908294153626080782693777003022566996735796983239343580281979005677758015801189957392350213806122307985157041153484138150252828152419133170303749
12654646219963267405298825104551142450213038420566798208417393291567314379831789259173233506811083774527183953999862675239292185131178671317061020444490733287588383918793095608410078925861028249824377
40992408416096028179761232532587525402909285099086220133403920525409552083528606215439915948260875718893797824735118621138192569490840098061133066650255608065609253901288801302035441884878187944219033


You can use this program to test for primality.

EDIT:

Use the following program to compute your score:

#!/usr/bin/python
# Usage: ./v.py ./find_large_primes

import subprocess
import sys

sum_ = 0
for n in xrange(200, 250):
  p = subprocess.Popen(
                   args=[sys.argv[1], str(n)],
                   stdout=subprocess.PIPE)
  p.wait()

  sum_ += sum(int(e) for e in p.stdout.read() if e.isdigit())
  p.stdout.close()

print sum_
C++ with GMP

#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;gmp.h&gt;

int main(int argc, char *argv[]) {
  int d = atoi(argv[1]);
  int i = 0;
  mpz_t n;
  mpz_init(n);
  mpz_ui_pow_ui(n, 10, d);
  mpz_sub_ui(n, n, 1);
  while (i &lt; 10) {
    if (mpz_probab_prime_p(n, 100)) {
      printf("%s\n", mpz_get_str(NULL, 10, n));
      i += 1;
    }
    mpz_sub_ui(n, n, 2);
  }
}


It runs in just under a second on my machine.  I'm too lazy to run it 50 times and sum up the digits, but it should be pretty good, as most of the digits (all but the last 4 of each number) are 9s.

&gt; ./a.out 250
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999967
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999323
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999017
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999998731
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997471
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999996959
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999995077
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999993529
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999993511
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999992459