Idoneal numbers: Difference between revisions

Content added Content deleted
(→‎{{header|Liberty BASIC}}: Added a solution.)
(added Arturo)
Line 143: Line 143:
312 330 345 357 385 408 462 520 760 840 1320 1365 1848
312 330 345 357 385 408 462 520 760 840 1320 1365 1848
</pre>
</pre>

=={{header|Arturo}}==

<syntaxhighlight lang="arturo">idoneal?: function [n][
loop 1..n 'a [
loop (a+1)..n 'b [
if n < a*b + a + b -> break
loop (b+1)..n 'c [
s: sum @[a*b b*c a*c]
if s = n -> return false
if s > n -> break
]
]
]
return true
]

idoneals: select 1..1850 => idoneal?

loop split.every: 13 idoneals 'x ->
print map x 's -> pad to :string s 4</syntaxhighlight>

{{out}}

<pre> 1 2 3 4 5 6 7 8 9 10 12 13 15
16 18 21 22 24 25 28 30 33 37 40 42 45
48 57 58 60 70 72 78 85 88 93 102 105 112
120 130 133 165 168 177 190 210 232 240 253 273 280
312 330 345 357 385 408 462 520 760 840 1320 1365 1848</pre>


=={{header|BASIC}}==
=={{header|BASIC}}==