[Rd] bug in primes() function in the schoolmath package (PR#11957)
    tacarey at gmail.com 
    tacarey at gmail.com
       
    Thu Aug  7 11:26:08 CEST 2008
    
    
  
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]]
    
    
More information about the R-devel
mailing list