hermann on Thu, 11 Apr 2024 10:43:03 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Better than "r=rec(...);if(r,return(r))" to end frst solution recursion? |
(factors 300 decimal digit semiprime n in ms, with both primes consisting of digits 3 and 7 only)
https://www.mersenneforum.org/showthread.php?p=654845#post654845 rec(n,p=0,q=0,m=1)={ if(n==p*q,return(p)); forstep(P=3*m,7*m,4*m, forstep(Q=3*m,7*m,4*m, if((n-(p+P)*(q+Q))%m==0, r=rec(n,p+P,q+Q,10*m);if(r,return(r)))));}I seem to remember that I got solution for "testret()" here before in some posting, but cannot find.
testret(r)=... ? allowing for if((n-(p+P)*(q+Q))%m==0, testret(rec(n,p+P,q+Q,10*m)))));} Regards, Hermann.