![]() |
|
|
#23 | |
|
Tribal Bullet
Oct 2004
67258 Posts |
Quote:
In fact, choosing an even multiplier is sometimes a win too, despite the fact that it reduces the frequency of powers of two in relations. My test C60 has an optimal multiplier of 6, and msieve runs twice as fast compared to the best odd multiplier. @smoking81: it's more intuitive to build your matrix so that the columns represent relations and the rows represent primes. This way the solution vector has one bit for every relation (0 = don't use, 1 = use) instead of one bit for every prime. Also, if you do not use the large prime variation, it's possible for the small prime variation to make things slower. Skipping small primes means you do a lot more trial division, especially if you're only looking for full relations. If trial division is slow compared to sieving, it could result in a net slowdown when you do more of it. Last fiddled with by jasonp on 2007-09-14 at 03:53 |
|
|
|
|
|
|
#24 |
|
"Nancy"
Aug 2002
Alexandria
2,467 Posts |
I couldn't reproduce k=71 as the optimal multiplier... I wrote a quick-and-dirty implementation in Pari/GP of KS as found in TAOCP, 4.5.4:
Code:
f(p, d) = {if(d%(p^2)==0,return(2./(p+1)+f(p,d/p^2)/p)); if(d%p==0,return(1/(p+1))); if(p==2&&d%4==3,return(1./3.)); if(p==2&&d%8==5,return(2./3.)); if(p==2&&d%8==1,return(4./3.)); if(kronecker(d,p)==1,return(2*p/(p^2-1))); return(0);}
ks(N, k, n) = {local(s, p); s=0.;forprime(p=2,n,s+=(f(p,k*N)-1/(p-1))*log(p));return(s-log(k)/2);}
Now I get Code:
? N=732197471686198597184965476425281169401188191; ? ks(N, 1, 100) %110 = -0.13205054122432296662436801768407422559 ? ks(N, 71, 100) %111 = -0.86459414391670106086722847847597662319 Something's wrong here (I just hope there's not some dumb bug in my code) Alex |
|
|
|
|
|
#25 | |
|
Sep 2007
11002 Posts |
Quote:
Silverman wrote in this same topic that the values of KS should be strictly positive. In fact when I got negative ones I had a bug in my code.. With k=71 my FB begins like this: -1 2 3 5 7 11 13 19 23 29 59 67 73 83 89 97 with k=1 indeed: -1 2 5 7 11 17 23 29 41 43 53 59 61 67 73 79 89 so I have more small primes in the FB when k=71... if the aim of evaluating ks is to achieve this result, then k=71 would be better than 1, isn't it? |
|
|
|
|
|
|
#26 |
|
Nov 2003
22·5·373 Posts |
Something is wrong. I get 15 as the best multiplier...... We try to factor: 732197471686198597184965476425281169401188191 i, test = 1 3 factors = 1 3 11 19 23 31 59 61 73 count = 9 Knuth value = 1.620993 i, test = 3 7 factors = 1 2 7 13 29 53 59 71 97 count = 9 Knuth value = 1.996679 i, test = 4 11 factors = 1 3 5 7 11 13 31 43 47 53 71 79 89 count = 13 Knuth value = 2.176029 i, test = 6 15 factors = 1 2 3 5 7 11 13 17 19 31 37 43 47 53 59 61 67 83 97 count = 19 Knuth value = 3.166916 i, test = 8 19 factors = 1 5 13 17 19 37 47 59 61 67 73 79 83 97 count = 14 Knuth value = 0.929538 i, test = 10 23 factors = 1 2 3 7 11 23 29 31 37 41 43 47 67 71 73 79 97 count = 17 Knuth value = 2.684286 i, test = 12 31 factors = 1 2 5 11 13 19 23 31 37 41 43 47 71 79 count = 14 Knuth value = 2.388305 i, test = 14 35 factors = 1 3 5 7 17 23 29 37 43 47 59 67 71 73 83 count = 15 Knuth value = 1.064989 i, test = 16 39 factors = 1 2 3 5 7 13 23 37 41 47 61 67 71 83 89 97 count = 16 Knuth value = 2.265376 i, test = 18 43 factors = 1 7 17 31 37 41 43 47 53 83 count = 10 Knuth value = 0.205570 i, test = 19 47 factors = 1 2 3 11 13 17 23 43 47 53 61 67 71 83 89 count = 15 Knuth value = 2.171651 i, test = 20 51 factors = 1 3 5 7 17 19 29 37 41 59 71 79 97 count = 13 Knuth value = 0.943500 i, test = 22 55 factors = 1 2 5 11 17 23 31 37 67 71 73 79 83 89 97 count = 15 Knuth value = 1.308345 i, test = 24 59 factors = 1 3 5 11 13 17 19 23 29 37 41 43 53 59 67 71 97 count = 17 Knuth value = 1.692477 i, test = 27 67 factors = 1 7 11 13 17 19 29 43 47 67 71 73 79 83 89 97 count = 16 Knuth value = 0.681312 i, test = 29 71 factors = 1 2 3 5 7 11 13 19 23 29 59 67 71 73 83 89 97 count = 17 Knuth value = 2.970742 i, test = 31 79 factors = 1 2 5 7 19 31 37 43 59 73 79 83 89 count = 13 Knuth value = 1.614011 i, test = 32 83 factors = 1 3 13 17 29 31 41 43 61 67 79 83 97 count = 13 Knuth value = 0.431694 i, test = 35 91 factors = 1 5 7 11 13 19 29 31 37 41 47 53 67 73 83 89 count = 16 Knuth value = 0.603504 i, test = 37 95 factors = 1 2 3 5 7 19 23 43 53 59 61 79 count = 12 Knuth value = 1.745014 i, test = 40 103 factors = 1 2 11 17 19 29 37 41 43 61 67 83 count = 12 Knuth value = 1.191968 Selected multiplier = 15 pmax = 58481 Note that my values of the KS function are all positive........ The output shows the factors in the factor base less than 100 for each multiplier. I am only using k so that kN = 1 mod 4. I use a slightly modified version of KS. It ignores the higher powers of the primes, so the probability is 2/p not 2/(p-1). The value of the KS function should be positive. |
|
|
|
|
|
#27 | ||
|
Sep 2007
1210 Posts |
Quote:
Quote:
|
||
|
|
|
|
|
#28 |
|
"Nancy"
Aug 2002
Alexandria
2,467 Posts |
The negative values of my ks() are due to the fact that I subtract 1/(p-1), i.e. the average exponent of p in "random integers" (chosen uniformly at random in [1, x] with x->∞, yadda yadda). I did it that way to be able to see the fluctuation of the result as n varies a bit better. Without that term, the result is indeed positive, and the extra term does not affect the optimal multiplier (for a given n) as it is just an additive term in the result that depends on n but not on N or k.
Alex PS: I get ? ks(N,1,100) %124 = -0.13205054122432296662436801768407422559 ? ks(N,15,100) %125 = -0.44704900313343378302569624353501420840 ? ks(N,71,100) %126 = -0.86459414391670106086722847847597662319 so 15 isn't all bad but not as good as 1, according to my ks(). Without the -1/(p-1), my KS value for k=15 is 3.6678, a bit higher than that listed by Bob's code. Last fiddled with by akruppa on 2007-09-14 at 13:55 |
|
|
|
|
|
#29 |
|
Aug 2002
Buenos Aires, Argentina
2·683 Posts |
My factorization applet also uses KS multiplier = 1 in this case.
Last fiddled with by alpertron on 2007-09-14 at 14:09 |
|
|
|
|
|
#30 | |
|
Nov 2003
746010 Posts |
Quote:
You are using 1/(p-1), while I used 1/p. |
|
|
|
|
|
|
#31 | |
|
Tribal Bullet
Oct 2004
1101110101012 Posts |
Quote:
Remember to account for the multiplier: your factor base can have more small primes but the multiplier could be too large, and sieve values could therefore grow on average, reducing the yield of relations. |
|
|
|
|
|
|
#32 |
|
"Ben"
Feb 2007
3×1,171 Posts |
71 seems to work best in practice. Here are some timings for the 3 different multipliers mentioned so far:
no small prime variation: k = 71, total time = 0.73sec k = 1, total time = 0.8sec k = 15, total time = 1sec I use a KS method similar to jason's, except i test slightly more primes and multipliers, and maximize instead of minimize. Last fiddled with by bsquared on 2007-09-14 at 15:54 |
|
|
|
|
|
#33 | |
|
Oct 2007
linköping, sweden
22×5 Posts |
Quote:
this number yields completely to Pollard rho; the largest prime factor (38 digits) can be certified by elementary means (Pratt)! |
|
|
|
|
![]() |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Sieving with powers of small primes in the Small Prime variation of the Quadratic Sieve | mickfrancis | Factoring | 2 | 2016-05-06 08:13 |
| Non-sieving version of Quadratic Sieve | mickfrancis | Factoring | 5 | 2016-03-31 06:21 |
| Quadratic Sieve by Hand | Sam Kennedy | Factoring | 20 | 2013-01-09 16:50 |
| Sieving polynoms in Quadratic Sieve | ThiloHarich | Factoring | 13 | 2009-01-04 18:19 |
| Quadratic Sieve in wikipedia.de | ThiloHarich | Factoring | 5 | 2006-07-14 09:51 |