Jump to content

O'Halloran numbers: Difference between revisions

added RPL
(Added JavaScript)
(added RPL)
Line 819:
8 12 20 36 44 60 84 116 140 156 204 260 380 420 660 924</pre>
 
=={{header|RPL}}==
{{trans|JavaScript}}
{{works with|HP|48}}
 
« 1000 DUP 2 / FLOOR 1 → maxarea halfmax ohalloran
« { }
8 maxarea '''FOR''' n
1 ohalloran SF
'''WHILE''' DUP halfmax ≤ ohalloran FS? AND '''REPEAT'''
1 halfmax '''FOR''' b
DUP b *
'''IF''' DUP n ≥ ohalloran FC? OR '''THEN''' DROP halfmax 'b' STO
'''ELSE'''
b halfmax '''FOR''' h
OVER h * OVER + h b * + DUP +
'''IF''' DUP n == '''THEN''' ohalloran CF '''END'''
'''IF''' n > ohalloran FC? OR '''THEN''' halfmax 'h' STO '''END'''
'''NEXT''' DROP
'''END'''
'''NEXT'''
1 +
'''END''' DROP
'''IF''' ohalloran FS? '''THEN''' n + '''END'''
2 '''STEP'''
» » '<span style="color:blue">OHALL</span>' STO
{{out}}
<pre>
1: { 8 12 20 36 44 60 84 116 140 156 204 260 380 420 660 924 }
</pre>
=={{header|Wren}}==
<syntaxhighlight lang="ecmascript">import "./seq" for Lst
1,151

edits

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