Well, let's say the program will work with primes up to 100,000. We write a program that gives a string like:
int prostie[] = {2,3,5,7,11,13 ...}
Paste into the main program (which we will ask as a solution). We add the code. Shakes Run... Code is too long...
Google, it turns out there is a limit of 64 KB. In normal programs, such data is displayed in a separate file. But in olympiads, as a rule, only one file can be submitted - the code itself. Bummer. What to do?
6n+1
and6n+5
for n> 0. Simple ones up to 6 are understandable. All numbers of a different type greater than 6 will be guaranteed to be composite (this is easily proved at the level of the third class). This reduces the number of numbers already 3 times. Further, these numbers can be stored for 1 bit per number. As a result, one byte "holds" 24 numbers. - KoVadim