[Rd] bug in primes() function in the schoolmath package (PR#11957)

From: <tacarey_at_gmail.com>
Date: Thu, 07 Aug 2008 11:26:08 +0200 (CEST)


I recently downloaded the R schoolmath package and found a bug in the "primes" function.
I'm not sure if it has been reported or not. I tried to report it to the maintainer, but the email
address listed was no longer available.

Anyway ...

If you run the example from the document *primes(12,150)* one of the numbers returned is *133*.
This is not a prime number since 7 x 19 = 1*33*. The is.prim() function works fine and if you use it to verify the primes() function you
will find several entries that return false.

> is.prim(primes(start=2, end=500))

 [1]  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE  TRUE

[13] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
[25] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE *FALSE* TRUE
TRUE
[37] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
[49] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE *FALSE* TRUE
TRUE
[61] TRUE TRUE TRUE TRUE TRUE *FALSE* TRUE TRUE TRUE TRUE TRUE
TRUE
[73] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
[85] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
[97] TRUE TRUE TRUE
thanks

        [[alternative HTML version deleted]]



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu 07 Aug 2008 - 12:39:29 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 07 Aug 2008 - 13:36:11 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive