Dan Bron wrote: > I doubt this approach will scale to 5e7 as required by the challenge.
Since 5e7*(anything)=(a lot), no, although if you are prepared to wait, you'll get an answer. I am not going to say anything else about the substance of the problem, so that I don't stray into spoiler country, but here is a meta-comment. If the sequence were arbitrary, then applying 1&p: or Miller-Rabin to each element would be a good solution. Since the sequence is not, we ought to be able to do better. Instead of asking how we can test an arbitrary number for primality, one should be asking how we can test a number in the sequence, and whether there is any regularity we can exploit. Best wishes, John ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
