Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #14356

Re: combinations problem

From Ray Koopman <koopman@sfu.ca>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: combinations problem
Date 2013-04-28 09:17 +0000
Message-ID <klipfc$123$1@smc.vnet.net> (permalink)
Organization Time-Warner Telecom

Show all headers | View raw


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 comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: combinations problem Ray Koopman <koopman@sfu.ca> - 2013-04-28 09:17 +0000

csiph-web