prime problem
Hey all, I've been part of gimps for some time now, and in a network security course I'm doing at uni we've been given the following problem:
 The project involves finding what Prof. Rivest calles "oreo cookies". These are consecutive integers (p, p+1, p+2) where p and p+2 are both prime, and the complete prime factorisation of p+1 is given. An example is (5, 2.3, 7), where "2.3" represents "two times three" (= 6). Your task is to find the largest oreo cookie you can, and send us the factorisation of p+1. The catch is that Prof. Rivest is currently only interested in oreo cookies where p+1 is divisible by 1997. Please note that the factorisation must be given as the product of powers of primes. For example, the factorisation of 96130371093750 should be given as: 2.3^2.5^17.7 which means 96130371093750 = 2*3(power of 2)*5(power of 17)*7.  was wondering if anyone could give me some tips on how to go about this problem? 
You are looking for "twin primes". Normally they are refered to by the number in the middle (n+1,n1). One of the math wizards here can tell you more.

The largest known twin prime is (33218925*(2^169690))1.
[url]http://primes.utm.edu/top20/page.php?id=1[/url] I think (but I'm not sure) that the other twin is (33218925*(2^169690))+1. The website didn't make that very clear. However, a quick check on a calculator reveals that none of the 20 twin primes have a middle number divisible by 1997. EDIT: [url]http://perso.wanadoo.fr/yves.gallot/primes/chrrcds.html#twin[/url] makes it clear that (33218925*(2^169690))+1 is indeed the other twin. 
So you're looking for values of n such that 1997n1 and 1997n+1 are prime.
The smallest such value of n is 54. Hint: n must be divisible by 6. 
There are some interesting tradeoffs in the difficulty of finding and proving large primes and the difficulty of factoring large numbers. The range of approaches also depends on how much time and computing power is available  a class collaboration for a semester could go much further than an individual for a night.
As jinydu pointed out, the middle number must be of the form 6x  otherwise at least one of the other numbers is divisible by 2 or 3. A little more work will also show that to eliminate 5 as a possible factor, the middle number must be either 30x or 30x+12. I'll stick with the 30x+12 case. You also require the middle number to be a multiple of 1997. So you need integer solutions to 30x+12=1997y Using Dario Alpern's [URL=http://www.alpertron.com.ar/QUAD.HTM]Quadratic Integer Solver[/URL], you can quickly find that solutions are of the form y= 6 + 30t Now you know the middle number is of the form 1997*(6+30*t). There are two general strategies from here. You can pick a range where you are sure you can factor 6+30t and look for the primes, or you can limit yourself to special values of 6+30t that are already factored. If you pick the second strategy, you may want to go back up a few paragraphs and pick the 30x route instead of the 30x+12 route. To find the primes, you'll want to use one of the sieving programs. I've never done such a search, but I think PFGW's "abc" format would work. To factor the middle number (if not forced to be prefactored), you might be able to use [URL=http://www.alpertron.com.ar/ECM.HTM]Dario Alpern's Factoring Applet[/URL]. For larger number you will need to use other methods. 
Searching in the 65 digit range, PFGW and Alpertron took only a few minutes to find the Oreo
2 ^ 2 x 3 ^ 2 x 1997 x 1339115036882491896284968410284302168768502494818994029419041 And less than five more minutes around 96 digits to find 2 ^ 2 x 3 x 7 x 13 x 71 x 1997 x 184607 x 1116853 x 91621069741259657 x 41725296244311767159315973024836146511068406178172970363089 
As you simply get larger, you run into the problem that you cannot factor the creme (middle of the oreo cookie). You can force the factorization to smaller numbers by proper selection of the form. For example, by choosing your (6+30t) to be 6*(1+5x)[sup]5[/sup], you can reduce the size of the remaining composite by a factor of 5. If you figure that you can probably factor 100 digit numbers, you can look for 500 digit oreos of the form 1997*6*(1+5t)[sup]5[/sup], where (1+5t) is 100 digits. It took a few hours to find a 505 digit oreo of this form:
2 x 3 x 7[sup]5[/sup] x 601[sup]5[/sup] x 1697[sup]5[/sup] x 1997 x 2221331321127842521176503[sup]5[/sup] x 170419913749602947794168163[sup]5[/sup] x 4046509251675607979406939228671806723909451[sup]5[/sup] Going much larger than this, your problem will be finding candidates. You will probably need a better search method. William 
thanks a lot for your help, i'll probably have some more questions later but i'll see where this gets me :)

hmm someone else in the class is already winning with a 5473 bit answer:
2^1307.3^2614.11.13.19.1997 damn! :P 
[QUOTE=Agrajag]in a network security course I'm doing at uni we've been given the following problem:[/QUOTE]
This is a good exercise. It lets you experience several key things: 1. Factoring is harder than primality proving. 2. Difficulty of increases rapidly with number size. 3. Better Algorithms are more important than faster hardware. 4. Competitive impulses can inspire communities to ever higher responses to security "puzzles." [QUOTE=Agrajag]hmm someone else in the class is already winning with a 5473 bit answer: 2^1307.3^2614.11.13.19.1997[/QUOTE] I left some of the algorithmic improvements for you to discover yourself. Instead you found #4. Trying for a grand slam beat the pants off response is risky because of #2. A slightly better answer is 15737*4013# "#" is the "primorial" symbol  it works like factorial except that only primes are included  so 4013# is the product of all prime numbers from 2 through 4013. It's an effective search idea because it guarantees that n1 and n+1 do not have small prime factors, increasing the probability they are prime. I picked 4013# to be a little larger than the outstanding record, then used PFGW's ABC2 file format to search for a prime pair (a*4013#1) and (a*4013#+1). It found 55 values of a where (a*4013#1) is prime but (a*4013#+1) is composite before finding this pair. Use [url=http://www.alpertron.com.ar/ECM.HTM]Dario Alpern's applet[/url] if you need an expansion or a list of the primes. If you win the class competition, I'd like of week of your wasted idle computer cycles on the ElevenSmooth factoring project. [url]http://ElevenSmooth.com[/url] William 
Thanks a lot for your help william! I think i'll try for an even higher one  if i get it i'll give you more than a weeks cpu cycles! (not too many though, gotta keep going with gimps :P). I found out today that apparently last years record was a 44k bit number!
question though  in "(a*4013#1) and (a*4013#+1)."  did you only use prime numbers for 'a'? Does that increase the probability of those expressions being prime too? 
How long does the contest run?
I used all numbers for "a" in my search. I think the impact of composite versus prime would be small. It would tend towards primes at small coefficients because composites would not exclude any new factors. At larger coefficients the composites would often weed out more than one prime, so the advantage probably switches to composite coefficients. 
[QUOTE=wblipp]How long does the contest run?[/QUOTE]
until the end of semester  so about 4 weeks from now 
In this case I recomend you to search primorial twins (sieve using NewPGen, and verify with pfgw) which are larger than the largest one thusfar this year.
If you have such a prime, you can try to beat the 44k bit candidate. 
[QUOTE=Agrajag]until the end of semester  so about 4 weeks from now[/QUOTE]
Is class over? What was your largest oreo, and what was the largest oreo in the class? How were they found? William 
it's not quite over, we've got until the 10th
I found an 11287 bit one, but someone has beaten me with a 34522 bit number, which I haven't tried to beat The number are viewable here: [url]http://www.it.usyd.edu.au/~dasymond/cookies.html[/url] thanks a lot for your help! :) 
that's a little larger than the [url]http://www.alpertron.com.ar/ECM.HTM[/url] ecm can handle :sad:

[QUOTE=Agrajag]it's not quite over, we've got until the 10th
I found an 11287 bit one, but someone has beaten me with a 34522 bit number, [/QUOTE] Are you feeling lucky? If so, I've got some sieved ranges you could test for much larger oreos. I started NewPgen on a range that I picked with too little preanalysis. When I got around to the analysis, the range was too large and the numbers were too large to have much hope of finishing in the time available. I let NewPgen run a couple of weeks  it removed about 84% of the range. With unlimited time it should be sieved more, but with a fixed deadline it was time to switch over to PRP testing using PFGW. In a week of PRP testing I've found about six primes, but no twin primes. I estimate that about one in a thousand primes will be part of a twin prime, so finding one in the next nine days requires incredible luck or incredible computing power. These numbers are over 19,000 digits (over 63,000 bits), so if you happen to find an oreo it will also be the eleventh largest known twin prime, and will be listable on Chris Caldwell's [URL=http://primes.utm.edu/top20/page.php?id=1]Top Twenty Twins Page[/URL]. Let me know if you want to put some computers to work. After June 10th I may return to sieving in an effort to find a listable twin. William 
if you send me some pfgw inputs i'd be more than happy to test them for a while  i have a couple of machines here that i can run it on  if you could email [email]phatfil@optusnet.com.au[/email] that'd be great
thanks a lot! :smile: 
[QUOTE=Agrajag]if you could email that'd be great[/QUOTE]
I sent a big chunk, then realized it was large enough that many mailboxes will refuse the attachment. So I zipped it and sent it again. Let me know if you don't get it. William 
time's up, guess I wasn't lucky enough :/
thanks a lot anyway! here's a list of prp's i found in that range (had 4 computers working on different parts of the range): 10000100001154*45007#1 10000100007604*45007#1 10000100011400*45007#1 10000100013880*45007#1 10000100016626*45007#1 10000100027119*45007#1 10000100029300*45007#1 10000100030374*45007#1 10000100034759*45007#1 10000100045165*45007#1 10000100050352*45007#1 10000100067637*45007#1 10000100068769*45007#1 10000100069793*45007#1 10000100071160*45007#1 10000100074401*45007#1 10000100309043*45007#1 10000100309745*45007#1 10000100310663*45007#1 10000100316772*45007#1 10000100318505*45007#1 10000100331208*45007#1 10000100621073*45007#1 10000100632859*45007#1 10000100636178*45007#1 10000100638029*45007#1 10000100647055*45007#1 10000100647299*45007#1 10000100800753*45007#1 10000100806036*45007#1 10000100813427*45007#1 10000100822318*45007#1 10000100822638*45007#1 10000100830454*45007#1 10000100835194*45007#1 10000100841890*45007#1 10000100847089*45007#1 10000100854782*45007#1 10000100858481*45007#1 10000100858863*45007#1 10000100868965*45007#1 10000100873980*45007#1 10000100875969*45007#1 10000100879221*45007#1 10000100879403*45007#1 
All times are UTC. The time now is 21:43. 
Powered by vBulletin® Version 3.8.11
Copyright ©2000  2021, Jelsoft Enterprises Ltd.