Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1995
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1995

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

Search the Archive

Re: Puzzle

  • To: mathgroup at smc.vnet.net
  • Subject: [mg2292] Re: [mg2258] Puzzle
  • From: Allan Hayes <hay at haystack.demon.co.uk>
  • Date: Mon, 23 Oct 1995 12:40:52 -0400

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