O'Halloran numbers: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (Restore my task description) |
(O'Halloran numbers in FreeBASIC) |
||
Line 59: | Line 59: | ||
8 12 20 36 44 60 84 116 140 156 204 260 380 420 660 924 |
8 12 20 36 44 60 84 116 140 156 204 260 380 420 660 924 |
||
</pre> |
</pre> |
||
=={{header|FreeBASIC}}== |
|||
<syntaxhighlight lang="freebasic">Const maxArea = 1000, halfMaxArea = maxArea/2 |
|||
Dim As Integer i, l, w, h, suma |
|||
Dim As Boolean T(halfMaxArea) 'table of half areas |
|||
For i = 0 To halfMaxArea-1 |
|||
T(i) = True 'assume all are O'kalloran numbers |
|||
Next i |
|||
For l = 1 To maxArea |
|||
For w = 1 To halfMaxArea |
|||
For h = 1 To halfMaxArea |
|||
suma = l*w + l*h + w*h |
|||
If suma < halfMaxArea Then T(suma) = False 'not an O'kalloran number |
|||
Next h, w, l |
|||
Print "All known O'Halloran numbers:" |
|||
Print "["; |
|||
For l = 6/2 To halfMaxArea-1 |
|||
If T(l) Then Print l*2; ","; |
|||
Next l |
|||
Print Chr(8); " ]" |
|||
Sleep</syntaxhighlight> |
|||
{{out}} |
|||
<pre>All known O'Halloran numbers: |
|||
[ 8, 12, 20, 36, 44, 60, 84, 116, 140, 156, 204, 260, 380, 420, 660, 924 ]</pre> |
|||
=={{header|J}}== |
=={{header|J}}== |