PRIC - Prime checker

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.

Output

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.

Score

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.

Example

Output:
01000000000000000000000000001000010000000001100000

should receive 50 points.


Added by:Gogu
Date:2006-08-29
Time limit:3.5s
Source limit:4096B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All

hide comments
2015-02-13 19:14:49 Ritesh
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 ?
2015-02-13 19:14:49 abhilash kumar
my code takes 2 sec on ideone.com n here it takes 20 secs..can anyone explain me this ??

Last edit: 2012-12-18 16:33:31
2015-02-13 19:14:49 Mostafa 36a2
Be attention that if your program remain "outputting" after 25 seconds you will got TLE
2015-02-13 19:14:49 Aditya Pande
miller rabin is too slow

Last edit: 2012-07-23 14:07:29
2015-02-13 19:14:49 David GarcĂ­a Soriano
How is it possible to receive TLE in this problem? Is there a minimum number of correct digits one has to output?
2015-02-13 19:14:49 Fadel SAAD
my code is 100% correct and the website give me runtime error (NZEC) ?????
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.