Le jeudi 5 mai 2011 18:43, Paul Johnson a écrit : > On Thu, May 05, 2011 at 08:20:13AM -0700, eventual wrote: > > Hi, Concerning the game Lotto, how do I generate a list of 6 numbers out > > of 12 numbers, eg > > > > given the 12 numbers as 1,2,3,4,5,6,7,8,9,10,11,12 > > the list of 6 numbers goes like this :- > > 1,2,3,4,5,6 > > 1,2,3,4,5,7 > > 1,2,3,4,5,8 > > 1,2,3,4,5,9 > > 1,2,3,4,5,10 ......... etc etc.... > > Thanks > > There appears to be a couple of modules on CPAN which can help you: > > http://search.cpan.org/perldoc?Math::Combinatorics > http://search.cpan.org/perldoc?Algorithm::Combinatorics > > And here's a little fun which uses the regexp engine to do the work for us: > > #!/usr/bin/perl > use 5.12.0; > use re "eval"; > my $r = join ".*?", map qr/(?<a$_>\b\d+\b)/, 1..shift; > my $s = join " ", 1..shift; > my @c; > $s =~ /$r(?{push @c, [values %+]})(?!)/; > say join ",", sort { $a <=> $b } @$_ for @c; > > Use it as: > > $ perl comb 6 12 > > -- > Paul Johnson - p...@pjcj.net > http://www.pjcj.net
you need a super calculateur or cluster to PS3 as to NASA I calculated a series of 8 digits on a slice of 1 to 20 on a PS3 in 36 hours and the result is a series of number in the order of 28Go -- http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x092164A7 gpg --keyserver pgp.mit.edu --recv-key 092164A7
pgpjo7G0dsGdb.pgp
Description: PGP signature