Jump to content

Prime decomposition: Difference between revisions

RPL: add section
(RPL: add section)
Line 5,076:
return 1
</syntaxhighlight>
 
=={{header|RPL}}==
≪ { } SWAP DUP √ CEIL → lim
≪ 2 '''WHILE''' OVER 1 > OVER lim ≤ AND '''REPEAT'''
DUP2 /
'''IF''' DUP FP '''THEN''' DROP DUP 2 ≠ + 1 +
'''ELSE''' SWAP ROT DROP ROT OVER + ROT ROT '''END'''
'''END'''
DROP
'''IF''' DUP 1 ≠ '''THEN''' + '''ELSE''' DROP '''END'''
≫ ‘'''DIVS'''’ STO
 
2 28 ^ 1 - ‘'''DIVS'''’
{{out}}
<pre>
1: { 3 5 29 43 113 127 }
</pre>
 
=={{header|Ruby}}==
1,150

edits

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