Idoneal numbers: Difference between revisions

no edit summary
m (→‎{{header|Lua}}: Doh! not x instead of x == false)
imported>Chinhouse
No edit summary
Line 764:
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|MiniScript}}==
<syntaxhighlight lang="miniscript">
isIdoneal = function(n)
for a in range(1, n)
for b in range(a + 1, n)
if a * b + a + b > n then break
for c in range(b + 1, n)
sum3 = a * b + b * c + a * c
if sum3 == n then return false
if sum3 > n then break
end for
end for
end for
return true
end function
 
idoneals = []
for n in range(1, 2000)
if isIdoneal(n) then idoneals.push(n)
end for
 
print idoneals.join(", ")
</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>
 
Anonymous user