Re: [R] Function to find prime numbers

2009-10-13 Thread Romain Francois
On 10/13/2009 09:59 AM, AJ83 wrote: I need to create a function to find all the prime numbers in an array. Can anyone point me in the right direction? Thank you. AJ There is isprime in package gmp. data.frame( number = 1:10, is.prime = isprime( 1:10 ) 1, is.probably.prime = isprime(1:10)

Re: [R] Function to find prime numbers

2009-10-13 Thread Gustaf Rydevik
library(gmp) ?isprime /Gustaf On Tue, Oct 13, 2009 at 9:59 AM, AJ83 aljense...@gmail.com wrote: I need to create a function to find all the prime numbers in an array. Can anyone point me in the right direction? Thank you. AJ -- View this message in context:

[R] Function to find prime numbers

2009-10-13 Thread AJ83
I need to create a function to find all the prime numbers in an array. Can anyone point me in the right direction? Thank you. AJ -- View this message in context: http://www.nabble.com/Function-to-find-prime-numbers-tp25868633p25868633.html Sent from the R help mailing list archive at

Re: [R] Function to find prime numbers

2009-10-13 Thread Thomas Lumley
On Tue, 13 Oct 2009, AJ83 wrote: I need to create a function to find all the prime numbers in an array. Can anyone point me in the right direction? It depends a bit on how big the numbers are. If the array is large but the numbers are not very large the fastest approach is probably to

Re: [R] Function to find prime numbers

2009-10-13 Thread Barry Rowlingson
On Tue, Oct 13, 2009 at 2:41 PM, Thomas Lumley tlum...@u.washington.edu wrote: On Tue, 13 Oct 2009, AJ83 wrote: I need to create a function to find all the prime numbers in an array. Can anyone point me in the right direction? This almost sounds like a homework problem to me... So here's a

Re: [R] Function to find prime numbers

2009-10-13 Thread joris meys
On Tue, Oct 13, 2009 at 5:30 PM, Barry Rowlingson b.rowling...@lancaster.ac.uk wrote: On Tue, Oct 13, 2009 at 2:41 PM, Thomas Lumley tlum...@u.washington.edu wrote: On Tue, 13 Oct 2009, AJ83 wrote: I need to create a function to find all the prime numbers in an array. Can anyone point me