Your submission should consist of 2 or more programs each written in distinct languages. They can be arbitrarily numbered from 1 to
p, given a natural number
n should print the next
n prime numbers (initially, the next prime is the 0-th prime, 2) on a single line, followed by a single blank newline, followed by a program fragment, which, when appended to the
p+1 mod kth program, produces the program which does precisely the same thing, but with the next prime being the
n+1th prime number.
- Your programs may accept its input as a function argument, or from standard input, or the closest equivalent in your languages.
- Your programs may not read data from any external source other than to read
nfrom standard input. If this data is required by your program, it must be included in the source code fragment generated by the previous program.
- Your programs may not compute any prime numbers less than the next prime number.
- The prime numbers may be separated by any delimiter other than a newline.
- You may not use any language primitives or libraries for prime number generation - you must write the algorithm yourself.
- You may use standard libraries for things other than prime generation.
- Two languages which differ only in their versions are not said to be distinct languages.
- Two languages whose semantics largely overlap (for example, C and C++) are not said to be distinct.
- Your programs may do whatever they like for undefined inputs.
- Your programs are required to support generating prime numbers up to 2^32-1. You may assume whatever you need about the runtime environment to ensure this is the case (i.e. you can assume your C program will be run on a machine where
inthas at least 32 bits). If this assumptions is non-trivial it should be stated explicitly.
- If running your program involves a non-trivial compilation step it should be stated how to do it, so others can reproduce it.
next in out 0 10 2,3,5,7,11,13,17,19,23,29 25 13 101,103,107,109,113,127,131,137,139,149,151,157,163 7 4 19,23,29,31
Because disk space is very expensive, your programs should be as small as possible. Because more is obviously better, your submission should consist of as many programs as possible. The score of your submission is the average byte count of your programs divided by the number of distinct languages used. Lowest score wins.