Radical of an integer: Difference between revisions

add RPL
m (→‎{{header|Phix}}: added links to other charbarcharts)
(add RPL)
Line 614:
Plus 1: 1
Total: 78,735
</pre>
 
=={{header|RPL}}==
<code>PDIV</code> is defined at [[Prime decomposition#RPL|Prime decomposition]]
 
<code>NODUP</code> is defined at [[Remove duplicate elements#RPL|Remove duplicate elements]]
 
'''Standard version'''
 
≪ <span style="color:blue">PDIV NODUP</span> 1 1 3 PICK SIZE '''FOR''' j OVER j GET * '''NEXT''' SWAP DROP ≫ '<span style="color:blue">RADIX</span>' STO
'''HP-48G and later models'''
 
≪ <span style="color:blue">PDIV NODUP</span> ΠLIST ≫ '<span style="color:blue">RADIX</span>' STO
Calls to solve the task:
≪ { 1 } 2 50 '''FOR''' n n <span style="color:blue">RADIX</span> + '''NEXT''' ≫ EVAL
99999 <span style="color:blue">RADIX</span>
499999 <span style="color:blue">RADIX</span>
999999 <span style="color:blue">RADIX</span>
≪ { 7 } 0 CON 1 1 PUT 2 10000 '''FOR''' n n <span style="color:blue">PDIV NODUP</span> SIZE DUP2 GET 1 + PUT '''NEXT''' ≫ EVAL
Looping one million times would need days to run on HP calculators and would wake up emulator's watchdog timer.
{{out}}
<pre>
5: { 1 2 3 2 5 6 7 2 3 10 11 6 13 14 15 2 17 6 19 10 21 22 23 6 5 26 3 14 29 30 31 2 33 34 35 6 37 38 39 10 41 42 43 22 15 46 47 6 7 10 }
4: 33333
3: 3937
2: 111111
1: { 1281 4097 3695 894 33 0 0 }
</pre>
 
1,151

edits