View Single Post
Old 2018-03-04, 07:38   #2
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

3·1,993 Posts
Default

Each of the phi(4800) = 1280 residue classes coprime to 4800 are (a priori) possible for q and r. But once you pick one that fixes the other. So you can search like this:

Code:
findCar3(p)=forprime(r=3,p-6, if(gcd(r,p-1)>1, next); my(q=lift(Mod(1/r,p-1))); if(q>r && q<p && isprime(q) && p*q%(r-1)==1 && p*r%(q-1)==1, return(p*q*r)))

findSpecialCar3(p)=forprime(r=3,p-6, if(gcd(r^2-r,p-1)>2, next); my(q=lift(Mod(1/r,p-1))); if(q>r && q<p && isprime(q) && p*q%(r-1)==1 && p*r%(q-1)==1 && gcd(q-1, p-1)==2 && gcd(q-1,r-1)==2, return(p*q*r)))

findCar3(4801)
findSpecialCar3(4801) \\ none to find

Last fiddled with by CRGreathouse on 2018-03-04 at 07:39
CRGreathouse is offline   Reply With Quote