Skip to main content
2 of 15
added 18 characters in body
Optimus
  • 549
  • 1
  • 4
  • 9

List of first 1000000 prime numbers most efficiently and in shortest code

Rules are simple -

  • First 1000000 primes should be printed to standard output separated by newlines (primes should be generated within the code)

  • Say, if we define Score = O(f([number of chars in the code])), f(n) being the complexity of your algorithm. So for example, if you have a 300 char code with O(n^2) complexity, score is 300^2 = 90000, for 300 chars with O(nlog2(n)), score becomes 3008.23 = 2468.65

  • Use any existing programming language, lowest score wins

To verify your solutions, a list of million primes is available here, (it's on google docs, pastebin won't let me upload a 8 Mb file without paying)

Please Include these in your solution -

  • what complexity your program has (include basic analysis if not trivial)

  • character length of code

  • the final calculated score

This is my first CodeGolf Question so, if there is a mistake or loophole in above rules please do point them out.

Optimus
  • 549
  • 1
  • 4
  • 9