Post Reply 
challenge for programmable calculators
12-22-2013, 04:41 AM
Post: #17
RE: challenge for programmable calculators
Great to see the better-than-brute-force solutions.

I offer these brute force solutions as baselines for anyone else wishing to try the problem. First, UserRPL for the 50g runs in about 15 seconds:
Code:

<<
 1. 9. FOR a
  1. 9. FOR b
   1. 9. FOR c
    a 10. * b + 10. * c +
    IF DUP a b c + + a b c * * * # THEN DROP END
   NEXT
  NEXT
 NEXT
>>

SysRPL for the 50g runs in just under two seconds:
Code:

!RPL !NO CODE
::
 9 1LAMBIND
 BEGIN
  10 ONE_DO
   10 ONE_DO
    1GETLAM #10* JINDEX@ #+ #10* INDEX@ #+
    1GETLAM JINDEX@ INDEX@ #+ #+
    1GETLAM JINDEX@ INDEX@ #* #* #*
    OVER #= ITE
     UNCOERCE
     DROP
  LOOP
 LOOP
 1GETLAM #1- DUP 1PUTLAM #0= UNTIL
 ABND
;
@

RPN for the 15C. Runs in ten seconds on the 15C+. For the 15C LE you'll have to replace the PSE with R/S then press R/S to see the other solutions.
Code:

LBL A
9
STO 0
STO 1
STO 2
LBL 1
EEX
1
RCL* 0
RCL+ 1
EEX
1
*
RCL+ 2
RCL 0
RCL+ 1
RCL+ 2
RCL* 0
RCL* 1
RCL* 2
x=y?
PSE
DSE 2
GTO 1
9
STO 2
DSE 1
GTO 1
STO 1
DSE 0
GTO 1
CLx

RPN for the WP 34S gives the first solution in about three seconds. R/S for the second solution almost instantaneously. Another R/S gives 0 almost instantaneously.
Code:

LBL D
#009
STO 00
STO 01
STO 02
RCL 00
SDL 001
RCL+ 01
SDL 001
RCL+ 02
RCL 00
RCL+ 01
RCL+ 02
RCL* 00
RCL* 01
RCL* 02
x=? Y
STOP
DSZ 02
BACK 014
#009
STO 02
DSZ 01
BACK 018
STO 01
DSZ 00
BACK 021
CLx
END
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: challenge for programmable calculators - kakima - 12-22-2013 04:41 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)