David Winsemius <dwinsemius <at> comcast.net> writes:

> 
> On Sep 21, 2010, at 11:33 AM, Cliff Clive wrote:
> 
> >
> > Hi everyone, I have a very quick question:
> >
> > Is there a ready-made function in R or any R packages to find the  
> > prime
> > factorization of an integer?
> 
> Yes. At least two. The obvious search strategy with your favrite  
> search tool should work well.
>

I don't know which prime factorization functions David means --- sometimes
these search tips are quite a mystery to me.

You didn't tell us an important parameter, namely the size of integers you
want to factorize. For larger numbers there is just one such function that
can be taken into consideration, i.e. factorize() in the multiple precision
package 'gmp'.

    library(gmp)
    factorize(2^32+1)
    # [1] "641"     "6700417"

And better do not use the 'schoolmath' package, this package is of very low
quality and probably should be removed from CRAN.

Hans Werner

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to