Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #14422
| From | totarefugium <mtaktikos@t-online.de> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: combinations problem |
| Date | 2013-05-06 06:25 +0000 |
| Message-ID | <km7ick$ica$1@smc.vnet.net> (permalink) |
| References | <klia8o$s8q$1@smc.vnet.net> |
| Organization | Time-Warner Telecom |
On 28.04.2013 06:58, eros olmi wrote:
> Hi
> i want to select 6 combinations from numbers 1 to 49 with condition that its sum equal 152,
>the following code works but its timing is 157 seconds on windows xp
mathematica v 8. can we make this timing shorter ?
> Select[Subsets[Range[49],{6}],Total[#]==152&]
Hi, the following should work about 68 times faster:
Select[Map[Union, IntegerPartitions[152, {6}, Range[49]]],
Length[#] == 6 & ]
cheers,
Michael Taktikos
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread
combinations problem eros olmi <erosolmiz@hotmail.com> - 2013-04-28 04:58 +0000 Re: combinations problem totarefugium <mtaktikos@t-online.de> - 2013-05-06 06:25 +0000
csiph-web