Make the primes generation go to the true square root of parameter

max.  (Pointed out by jb@dilbert.apo.nmsu.edu (Jon Brinkmann) on
usenet.)
This commit is contained in:
phil 1998-02-19 18:37:58 +00:00
parent c611491733
commit a924a02bc1
1 changed files with 2 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: factor.c,v 1.4 1997/12/20 23:47:02 cjs Exp $ */
/* $NetBSD: factor.c,v 1.5 1998/02/19 18:37:58 phil Exp $ */
/*
* Copyright 1997 Piermont Information Systems Inc.
@ -63,7 +63,7 @@ static void build_primes (long max)
primes[0] = 2;
primes[1] = 3;
for (pc = primes[num_primes-1]; pc < 46345 && pc*pc < max; pc+=2) {
for (pc = primes[num_primes-1]; pc < 46345 && pc*pc <= max; pc+=2) {
j = 0;
rem = 1;
while (j<num_primes && primes[j]*primes[j] <= pc) {