Mathematica 9 is now available
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: [mg2280] Re: [mg2258] Puzzle
  • From: brucec (Bruce Carpenter)
  • Date: Mon, 23 Oct 1995 12:38:46 -0400

>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

The easiest way I've found is:

In[6]:=
{6, 44, 30, 15, 24, 12, 33, 23, 18}/.
{a___,b_,c___,d_,e___,f_,g___,h_,i___} /; b + d + f + h == 100 -> {b,d,f,h}
Out[6]=
{44, 15, 23, 18}

Cheers,
Bruce Carpenter




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