Multiplicatively perfect numbers: Difference between revisions
Content added Content deleted
(Added XPL0 example.) |
(Added FreeBASIC) |
||
Line 10: | Line 10: | ||
Find and show on this page the Special numbers where n < 500 |
Find and show on this page the Special numbers where n < 500 |
||
<br> |
<br> |
||
=={{header|FreeBASIC}}== |
|||
<syntaxhighlight lang="vb">#define ceil(x) (-((-x*2.0-0.5) Shr 1)) |
|||
Dim As Integer limit = 500 |
|||
Dim As Integer n, pro, Divisors(), m, c = 0, ub |
|||
Print "Special numbers under"; limit; ":" |
|||
For n = 1 To limit |
|||
pro = 1 |
|||
For m = 2 To ceil(n / 2) |
|||
If n Mod m = 0 Then |
|||
pro *= m |
|||
Redim Preserve Divisors(c) : Divisors(c) = m |
|||
c += 1 |
|||
End If |
|||
Next m |
|||
ub = Ubound(Divisors) |
|||
If n = pro And ub > 1 Then |
|||
Print Using "### = ## x ###"; n; Divisors(ub-1); Divisors(ub) |
|||
End If |
|||
Next n |
|||
Sleep</syntaxhighlight> |
|||
{{out}} |
|||
<pre>Similar to Ring entry.</pre> |
|||
=={{header|Phix}}== |
=={{header|Phix}}== |