Post Reply 
challenge for programmable calculators
12-22-2013, 12:14 AM
Post: #9
RE: challenge for programmable calculators
(12-21-2013 11:26 PM)Gerson W. Barbosa Wrote:  
(12-21-2013 10:26 PM)Katie Wasserman Wrote:  
Code:

%%HP: T(3)A(D)F(.);
\<< 1. 9.
FOR a 1. 9.
FOR b a SQ b * a b SQ * + 1. - NEG DUP SQ a b * 4. * a 100. * b 10. * + * + \v/ + a b * 2. * / DUP FP NOT NOT { DROP } { DUP 10. < { a 100. * b 10. * + + } { DROP } IFTE } IFTE
NEXT
NEXT
\>>

Nice use of the quadratic formula to save the inner-most loop -- compared to the brute force solution. I wonder if there's an even better way.

Perhaps one should analyze the formula and limit the outer loop (I haven't done that). BTW, I have to say "my" method is kind of cheating, since the hard work was done by W|A:

solve a*b*c*(a+b+c)==100*a+10*b+c for a, b and c

Gerson, I've never used Wolfram Alpha, but from your link, it does not appear to give the actual answer, ie, the two numbers.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: challenge for programmable calculators - Don Shepherd - 12-22-2013 12:14 AM
Proof using number theory - cruff - 12-24-2013, 05:43 PM
RE: challenge for programmable calculators - radwilliams - 12-24-2013, 05:57 PM



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