I have a problem with permutations functions in R I just started using R so maybe it is an easy question I need to obtain all the 9.somthingExp 157 permutations that can be given from the number from 1 to 100 I wrote the following commands:> library(gregmisc)>options(expressions=1e5)cmat <- combinations(300,2) dim(cmat) # 44850 by 2>permutations(n=100, r=100)Unfortunately at a certain point (after few minutes) I get the following Error: Error: cannot allocate vector of size 609.1 Mb What can I do? Thanks Fabio [[alternative HTML version deleted]]
On 24-Nov-08 13:36:31, Mulazzani Fabio (Student Com06) wrote:> I have a problem with permutations functions in R > I just started using R so maybe it is an easy question > I need to obtain all the 9.somthingExp 157 permutations that can be > given from the number from 1 to 100 > > I wrote the following commands: > >> library(gregmisc) >>options(expressions=1e5) > cmat <- combinations(300,2) > dim(cmat) # 44850 by 2 >>permutations(n=100, r=100) > > Unfortunately at a certain point (after few minutes) I get the > following Error: > > Error: cannot allocate vector of size 609.1 Mb > > What can I do? > Thanks > FabioThe first thing to do is to decide how long you are willing to wait! To an adequate approximation there are 10^158 of them. Simply to obtain them all (at a rate of 10^10 per second, which is faster than the CPU frequency of most desktop computers) would take 10^148 seconds, or slightly longer than 3*(10^140) years. Current estimates of the age of the Universe are of the order of 1.5*(10^10) years, so the Universe will have to last about 2*(10^130) times as long as it has already existed, before the task could be finished. So: why do you want to do this? Best wishes, Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk> Fax-to-email: +44 (0)870 094 0861 Date: 24-Nov-08 Time: 16:43:29 ------------------------------ XFMail ------------------------------
> To an adequate approximation there are 10^158 of them. > Simply to obtain them all (at a rate of 10^10 per second, which is > faster than the CPU frequency of most desktop computers) would take > 10^148 seconds, or slightly longer than 3*(10^140) years. > > Current estimates of the age of the Universe are of the order of > 1.5*(10^10) years, so the Universe will have to last about 2*(10^130) > times as long as it has already existed, before the task could > be finished. > > So: why do you want to do this? > >I want to nominate this as a fortune. How to do it? ;-) Stefan
You can also add to the fortune is that there are "approximately" 10^24 grains of sands on the earth. If every one could store a permutation, you are still way short of the storage that you would need. On Mon, Nov 24, 2008 at 12:01 PM, Stefan Grosse <singularitaet at gmx.net> wrote:> >> To an adequate approximation there are 10^158 of them. >> Simply to obtain them all (at a rate of 10^10 per second, which is >> faster than the CPU frequency of most desktop computers) would take >> 10^148 seconds, or slightly longer than 3*(10^140) years. >> >> Current estimates of the age of the Universe are of the order of >> 1.5*(10^10) years, so the Universe will have to last about 2*(10^130) >> times as long as it has already existed, before the task could >> be finished. >> >> So: why do you want to do this? >> >> > > I want to nominate this as a fortune. How to do it? > > ;-) > > Stefan > > ______________________________________________ > R-help at 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. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve?