MathGroup Archive 1995

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

Search the Archive

Re: Puzzle

  • To: mathgroup at smc.vnet.net
  • Subject: [mg2285] Re: [mg2258] Puzzle
  • From: Don Piele <piele at cs.uwp.edu>
  • Date: Mon, 23 Oct 1995 12:39:39 -0400



On Thu, 19 Oct 1995, Will Self wrote:

> Here's a nice puzzle.  Find the four numbers in the following sequence
> which total 100:  {6, 44, 30, 15, 24, 12, 33, 23, 18}.  It would seem that
> there might be a nice way to do this with Mathematica.  Any takers?
> 
> Will Self
> Billings, Montana
> 
> 
Sure.

Construct all 4 element subsets with KSubsets.
Select those who sum to 100.


Needs["DiscreteMath`Combinatorica`"]
Select[KSubsets[{6, 44, 30, 15, 24, 12, 33, 23, 18},4],
                #[[1]]+#[[2]]+#[[3]]+#[[4]]==100&]

Out[1]=
{{44, 15, 23, 18}}

D. Piele




  • Prev by Date: Log Plots
  • Next by Date: Matrix multiplication
  • Previous by thread: Re: Puzzle
  • Next by thread: Re: Puzzle