Post Reply 
HHC 2017 RPN Programming contest information and results thread
10-01-2017, 09:50 PM (This post was last modified: 10-06-2017 06:32 PM by Jeff O..)
Post: #48
RE: HHC 2017 RPN Programming contest information and results thread
Best I could do on my own before checking the solutions here was 70 bytes, no registers. I kept searching the manual for a command to convert a byte code to a number (to avoid 48, -), but sadly, no such command exists. Using SIGN in lieu of RDN, 1 drops mine to 69 bytes. (I'll never remember that function!) Without a major re-write that would likely just turn it into one of the ones provided by others, I don't see any opportunities for improvement. The improved (using SIGN) program is provided below for review.

Thanks Gene, another fun and interesting challenge. Maybe I am mistaken, but it seems like there are lots more "Unhappy" than "Happy" numbers. Is this true? Did anyone figure out what the highest number of cycles for a 10 digit or smaller number leading to a "Happy" result is?

Code:
01 LBL HAPPY
02 CLA
03 CF 29
04 FIX 0
05 0
06 STO Z
07 LBL 01
08 RDN
09 ARCL X
10 CLX
11 LBL 04
12 ATOX
13 X=0?
14 GTO 05
15 48
16 -
17 X^2
18 +
19 GTO 04
20 LBL 05
21 SIGN
22 ST+ Z
23 X=Y?
24 GTO 03
25 RDN
26 4
27 X=/=Y? 
28 GTO 01
29 "UN"
30 LBL 03
31 |- "HAPPY "
32 ARCL Z
33 FIX 4
34 SF 29
35 AVIEW
36 END

69 bytes, no registers

Dave - My mind is going - I can feel it.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HHC 2017 RPN Programming contest information and results thread - Jeff O. - 10-01-2017 09:50 PM



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