Jump to content

Increasing gaps between consecutive Niven numbers: Difference between revisions

added RPL
(Added Easylang)
(added RPL)
 
Line 2,151:
tell: say arg(1); return</syntaxhighlight>
{{out|output|text=&nbsp; is identical to the 1<sup>st</sup> REXX version.}} <br><br> !-->
 
=={{header|RPL}}==
{{works with|RPL|HP49-C}}
« →STR 0.
1. PICK3 SIZE '''FOR''' j
OVER j DUP SUB STR→ +
'''NEXT''' NIP
» '<span style="color:blue">∑DIG</span>' STO
« '''DO''' 1 + '''UNTIL''' DUPDUP <span style="color:blue">∑DIG</span> / FP NOT '''END'''
» '<span style="color:blue">NEXTNIVEN</span>' STO
« { { 1 1 1 1 } } 1 1 1 → res gap gapindex nivindex
« 1
'''WHILE''' res SIZE 15 < '''REPEAT'''
DUP <span style="color:blue">NEXTNIVEN</span> DUP2 SWAP -
'''IF''' DUP gap >
'''THEN''' DUP 'gap' STO 'gapindex' INCR SWAP nivindex 5 ROLL
4 →LIST 1 →LIST 'res' SWAP STO+
'''ELSE''' ROT DROP2 '''END'''
'nivindex' 1 STO+
'''END'''
DROP res
» » '<span style="color:blue">TASK</span>' STO
{{out}}
<pre>
1: { { 1 1 1 1 } { 2 2 10 10 } { 3 6 11 12 } { 4 7 26 63 } { 5 8 28 72 } { 6 10 32 90 } { 7 12 83 288 } { 8 14 102 378 } { 9 18 143 558 } { 10 23 561 2889 } { 11 32 716 3784 } { 12 36 1118 6480 } { 13 44 2948 19872 } { 14 45 4194 28971 } { 15 54 5439 38772 } }
</pre>
 
=={{header|Ruby}}==
Line 2,192 ⟶ 2,220:
126 6292149 88996914
</pre>
 
=={{header|Rust}}==
<syntaxhighlight lang="rust">// [dependencies]
1,151

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.