Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #14356 > unrolled thread
| Started by | Ray Koopman <koopman@sfu.ca> |
|---|---|
| First post | 2013-04-28 09:17 +0000 |
| Last post | 2013-04-28 09:17 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
Re: combinations problem Ray Koopman <koopman@sfu.ca> - 2013-04-28 09:17 +0000
| From | Ray Koopman <koopman@sfu.ca> |
|---|---|
| Date | 2013-04-28 09:17 +0000 |
| Subject | Re: combinations problem |
| Message-ID | <klipfc$123$1@smc.vnet.net> |
Timing@Length@Select[Subsets[Range[49],{6}],Total[#]==152&]
{211.15, 165490}
Timing@Length@Select[IntegerPartitions[152,{6},Range@49],Unequal@@#&]
{1.86, 165490}
On Sat, Apr 27, 2013 @ 09:58 PM, eros olmi <erosolmiz@hotmail.com> 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&]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web