I'm not sure that I'd bother using J for something that I can do in my
head (except, maybe, to test my result)

Algebraically, though (using J notation but with added parenthesis for
people not comfortable with J's details):
   (x+1) = 2 * (x-1)

(x was the original amount).

And, as it happens, this is expression is roughly "good enough" to
solve the problem (since it's an easy one):
   x=:i.20
   I. (x+1) = 2 * (x-1)
3

But, of course, you could also solve it through algebraic (syntax and
constraint based) manipulations.

As an aside, note that I. is related to the secant method of numerical analysis.

That said, note that "time to solve" especially for short puzzles says
more about the state of mind of the solver than it says about the
puzzle.

Thanks,

-- 
Raul


On Mon, Feb 25, 2013 at 12:34 PM, km <[email protected]> wrote:
> Here is a two-minute puzzle.  Ike and Mike have the same number of pennies, 
> but if Ike gives Mike one penny, Mike will have twice as many as Ike.  How 
> many pennies does each have?
>
> When I was learning algebra I spent hours devising a solution using two 
> equations in two unknowns, not noticing that one equation in one unknown 
> would do.  When I raised this question at dinner with my daughter she solved 
> it in seconds by pushing peas around on her plate.  Solve it in seconds with 
> a J exploration!
>
> Kip Murray
>
> Sent from my iPad
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to