MathGroup Archive 2013

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: combinations problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg130654] Re: combinations problem
  • From: Dana DeLouis <dana01 at icloud.com>
  • Date: Tue, 30 Apr 2013 04:17:44 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net

On Sunday, April 28, 2013 5:17:32 AM UTC-4, Ray Koopman wrote:

> I want to select 6 combinations from numbers 1 to 49 with condition that its sum equal 152,

> Timing@Length@Select[IntegerPartitions[152,{6},Range@49],Unequal@@#&]
>
> {1.86, 165490}
>

Hi.  Just an interesting way to confirm the number of solutions:

Timing[Coefficient[Expand[Coefficient[
     Product[k*t^n + 1, {n, 49}], k, 6]], t, 152]]

{0.079659,165490}

= = = = = = = = = =
HTH  :>)
Dana DeLouis
Mac & Mathematica 9
= = = = = = = = = =





  • Prev by Date: Farewell to a friend
  • Next by Date: Re: how to generate piecewise function from two lists
  • Previous by thread: Re: combinations problem
  • Next by thread: how to generate piecewise function from two lists