Smallest multiple: Difference between revisions
add fermat
(add fermat) |
|||
Line 139:
232792560
</pre>
=={{header|Fermat}}==
<lang fermat>Func Ilog( n, b ) =
i:=0; {integer logarithm of n to base b, positive only}
while b^i<=n do
i:+;
od;
i-1.;
Func Smalmul( n ) =
s:=1;
for a = 1 to n do
if Isprime(a) then s:=s*a^Ilog(n, a) fi;
od;
s.;
!Smalmul(20);
</lang>
{{out}}<pre>232792560</pre>
=={{header|FreeBASIC}}==
|