Greatest prime dividing the n-th cubefree number: Difference between revisions

Content added Content deleted
m (Minor change.)
(added RPL)
Line 24: Line 24:
;Reference
;Reference
* [https://oeis.org/A370833 OEIS sequence: A370833: a(n) is the greatest prime dividing the n-th cubefree number, for n >= 2; a(1)=1.]
* [https://oeis.org/A370833 OEIS sequence: A370833: a(n) is the greatest prime dividing the n-th cubefree number, for n >= 2; a(1)=1.]

=={{header|RPL}}==
I confirm it does take a while for an interpreted language like RPL. Getting the 100,000th term is likely to be a question of hours, even on an emulator.
{{works with|HP|49}}
« 1 { } DUP2 + → n res2 res1
« 2
'''WHILE''' 'n' INCR 10000 ≤ '''REPEAT'''
'''WHILE''' DUP FACTORS DUP 1 « 3 < NSUB 2 MOD NOT OR » DOSUBS ΠLIST NOT
'''REPEAT''' DROP 1 + '''END'''
HEAD
'''CASE'''
n 100 ≤ '''THEN''' 'res1' OVER STO+ '''END'''
n LOG FP NOT '''THEN''' 'res2' OVER STO+ '''END'''
'''END'''
DROP 1 +
'''END'''
DROP res1 res2
» » '<span style="color:blue>TASK</span>' STO
{{out}}
<pre>
2: { 1 2 3 2 5 3 7 3 5 11 3 13 7 5 17 3 19 5 7 11 23 5 13 7 29 5 31 11 17 7 3 37 19 13 41 7 43 11 5 23 47 7 5 17 13 53 11 19 29 59 5 61 31 7 13 11 67 17 23 7 71 73 37 5 19 11 13 79 41 83 7 17 43 29 89 5 13 23 31 47 19 97 7 11 5 101 17 103 7 53 107 109 11 37 113 19 23 29 13 59 }
1: { 109 101 }
</pre>


=={{header|Wren}}==
=={{header|Wren}}==