Post Reply 
July 2018 little math problem
07-26-2018, 04:03 AM
Post: #8
RE: July 2018 little math problem
(07-26-2018 12:57 AM)John Keith Wrote:  So did I!

Emulated HP 50g with the ListExt Library took 3437 seconds on an ancient WinXP laptop. Same results.

...and yet another "brute force" method using ListExt with a slight twist on the check.

Code:

Spoiler alert!












\<<
  0. 8. NDUPN \-> a b c d e f g h i
  \<<
    9. DUP LSEQ
    SWAP
    \<<
      { a b c d e f g h i } STO

      a b + d e + SAME
      {
        c d + f g + SAME
        {
          e f + h i + SAME
          {
            { a b c d e f g h i } LRCL R\->I
          }
          IFT
        }
        IFT
      }
      IFT
    \>>
    DOPERM
  \>>
\>>

I assumed (hopefully correctly) that the following conditions had to hold:

a + b = d + e
c + d = f + g
e + f = h + i

So I nested the above tests to short-circuit them.  If a + b ≠ d + e, then there's
no reason to continue checking.  If it is, then if c + d ≠ f + g, there's no reason to
continue checking, etc.

The short-circuit made for a nice speed improvement over checking everything
each time through.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
July 2018 little math problem - pier4r - 07-25-2018, 08:52 PM
RE: July 2018 little math problem - DavidM - 07-26-2018 04:03 AM
RE: July 2018 little math problem - DavidM - 07-26-2018, 03:38 PM
RE: July 2018 little math problem - pier4r - 07-26-2018, 12:36 PM
RE: July 2018 little math problem - pier4r - 07-27-2018, 10:03 AM
RE: July 2018 little math problem - DavidM - 07-28-2018, 04:22 PM
RE: July 2018 little math problem - pier4r - 08-01-2018, 02:13 PM



User(s) browsing this thread: 1 Guest(s)