MathGroup Archive 1995

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

Search the Archive

Re: Puzzle


Will Self <wself at viking.emcmt.edu>
in [mg2258] Puzzle

>Find the four numbers in the following sequence
>which total 100:  {6, 44, 30, 15, 24, 12, 33, 23, 18}.

Will:

<<DiscreteMath`Combinatorica`

   ?KSubsets
      KSubsets[l,k] returns all subsets of set l containing exactly k   
      elements,ordered lexicographically.

   Select[
      KSubsets[{6, 44, 30, 15, 24, 12, 33, 23, 18},4],
      Plus@@# == 100&
   ]

      {{44, 15, 23, 18}}

Allan Hayes
hay at haystack.demon.co.uk


  • Prev by Date: Kernel function to create Windows Metafile?
  • Next by Date: Re: Puzzle
  • Previous by thread: Re: Puzzle
  • Next by thread: Re: Puzzle