Post Reply 
challenge for programmable calculators
12-22-2013, 12:49 AM
Post: #13
RE: challenge for programmable calculators
(12-22-2013 12:39 AM)Gerson W. Barbosa Wrote:  
(12-22-2013 12:14 AM)Don Shepherd Wrote:  Gerson, I've never used Wolfram Alpha, but from your link, it does not appear to give the actual answer, ie, the two numbers.

Don, it gives 'c' as a function of 'a' and 'b' (third formula). This saves the outer loop, so the inner loop, albeit now a bit more complicated, is executed 81 times instead of 729 times. But I think there is still room for optimization. The BASIC program might be more clear to those not familiar with RPL:

Code:

FOR A = 1 TO 9
  FOR B = 1 TO 9
    T = A * A * B + A * B * B - 1
    C = (SQR(T * T + 4 * A * B * (100 * A + 10 * B)) - T) / (2 * A * B)
    IF INT(C) < 10 THEN IF C - INT(C) = 0 THEN PRINT 100 * A + 10 * B + C
  NEXT B
NEXT A

Very interesting, Gerson, thanks. BASIC I understand! I'll have to study this awhile.
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:49 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)