Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix(?) a bug in factor_lehman

  • Loading branch information...
commit c76b9a229e13ceeb88a146c60592c4242df4412e 1 parent e520083
@fredrik-johansson fredrik-johansson authored
View
2  ulong_extras/factor_lehman.c
@@ -58,7 +58,7 @@ mp_limb_t n_factor_lehman(mp_limb_t n)
for (k = 1; k <= cuberoot + 1; k++)
{
mp_limb_t x = (mp_limb_t) ceil(2.0*sqrt((double) k)*sqrt((double) n));
- mp_limb_t end = x + (mp_limb_t) floor(1.0 + pow(n, 1.0/6.0)/((double) 4.0*sqrt((double) k)));
+ mp_limb_t end = x + (mp_limb_t) floor(1.0 + pow(n, 1.0/6.0)/((double) 4.0*sqrt((double) k))) + 1;
mp_limb_t sub = k*n*4;
for ( ; x <= end; x++)
View
9 ulong_extras/test/t-factor_lehman.c
@@ -78,6 +78,15 @@ int main(void)
n1 = n_nextprime(n1, 1);
n2 = n_nextprime(n2, 1);
+ /* test a specific bug */
+#if FLINT64
+ if (i == 0)
+ {
+ n1 = 72528697;
+ n2 = 73339073;
+ }
+#endif
+
n = n1*n2;
n3 = n_factor_lehman(n);
Please sign in to comment.
Something went wrong with that request. Please try again.