Narcissistic decimal number: Difference between revisions
m
→{{header|RPL}}
m (→{{header|RPL}}) |
|||
Line 4,907:
</syntaxhighlight>
=={{header|
We started the challenge on a genuine HP-28S, powered by a 4-bit CPU running at 2 MHz.
≪ DUP XPON 1 + → n m
Line 4,913:
10 MOD LAST / IP SWAP m ^ ROT + SWAP '''END'''
DROP n ==
≫ ≫
≪ { 0 } 1 999 '''FOR''' n IF n
≫
It took 4 minutes and 20 seconds to get the first 14 numbers.
{{out}}
Line 4,927:
≪ { 999 } 0 CON
0 9 '''FOR''' h 0 9 '''FOR''' t 0 9 '''FOR''' u
'''IF''' h t u + + '''THEN''' h 100 * t 10 * u + + h m ^ t m ^ u m ^ + + PUT '''END
'<span style="color:green">POWM</span>' STO
≫ ≫ '<span style="color:blue">INIT</span>' STO
≪ DUP XPON 1 + → n m
Line 4,935 ⟶ 4,936:
'''WHILE''' DUP '''REPEAT'''
1000 MOD LAST / IP
'''IF''' SWAP '''THEN''' LAST
'''END''' DROP n ==
≫ ≫ '
≪ DUP <span style="color:blue">INIT</span> DUP ALOG SWAP 1 - ALOG
'''WHILE''' DUP2 > '''REPEAT'''
'''IF''' DUP
1 +
'''END''' DROP2
≫ '<span style="color:blue">RTASK</span>' STO
{{in}}
<pre>
|