Hi, I found a small 'bug' in factor.c. It's not really a bug, it just could be done better.
Explanation: factor should return no factors if n = 0 or n = 1, so I would suggest changing


if (n < 1)

to

if (n < 2)

see factor.dif



The real reason for this mail is the primes program. In the TODO file I found that it still has to be written. I would like to provide one and to put it under the GPL. But I have a few questions.


What should the primes program exactly do? Print all the primes <= n? Or print all the primes between two integers? Print pi(x)?
btw. pi(x) is the number of primes <= x, in case you don't know.


What is meant by "gmp" in
TODO:
"- write (or find version that we can copyleft) primes, using gmp"?



Will it be important to use a small amount of memory?
--- src/factor.c        Tue Jul  2 07:21:02 2002
+++ projekte/factor.c   Tue Mar 25 16:49:14 2003
@@ -101,7 +101,7 @@ factor (uintmax_t n0, int max_n_factors,
   int n_factors = 0;
   unsigned int const *w = wheel_tab;
 
-  if (n < 1)
+  if (n < 2)
     return n_factors;
 
   /* The exit condition in the following loop is correct because
_______________________________________________
Bug-sh-utils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-sh-utils

Reply via email to