PRIC - Prime checker

no tags 

For this task you will have to check as many numbers as possible to see if they are prime. As not to make the problem I/O oriented, consider the numbers you should check in the following order: first take 1 and then construct the numbers in the sequence after the recursion: ai=(ai-1+1234567890) mod 231. Be careful not to use more than 4096 bytes of code.


For each number you should write to output the digit "1" if the number is prime or the digit "0" if it is not prime.


The score of your program will be the index of the first number in the sequence after which you do not have a correct answer. Because of some limitation you should not write more than 33 333 333 characters to output. If you reach this limit, your score will be adjusted in accordance to your runtime.



should receive 50 points.

hide comments
Ritesh: 2015-02-13 19:14:49

if we should write a maximum of 33,333,333 characters to the output, this means a maximum score of 33,333,333. Then how the hell does the top ranker has a score of 1,700,680,255 ?

abhilash kumar: 2015-02-13 19:14:49

my code takes 2 sec on n here it takes 20 secs..can anyone explain me this ??

Last edit: 2012-12-18 16:33:31
Mostafa 36a2: 2015-02-13 19:14:49

Be attention that if your program remain "outputting" after 25 seconds you will got TLE

Aditya Pande: 2015-02-13 19:14:49

miller rabin is too slow

Last edit: 2012-07-23 14:07:29
David GarcĂ­a Soriano: 2015-02-13 19:14:49

How is it possible to receive TLE in this problem? Is there a minimum number of correct digits one has to output?

Fadel SAAD: 2015-02-13 19:14:49

my code is 100% correct and the website give me runtime error (NZEC) ?????

Added by:Gogu
Time limit:3.5s
Source limit:4096B
Memory limit:1536MB
Cluster: Cube (Intel G860)