Anti-primes: Difference between revisions

Add Maple implementation
m (→‎even and odd numbers: added wording to the section header.)
(Add Maple implementation)
Line 994:
7560
Done.</pre>
 
=={{header|Maple}}==
<lang Maple>antiprimes := proc(n)
local ap, i, max_divisors, num_divisors;
max_divisors := 0;
ap := [];
 
for i from 1 while numelems(ap) < n do
num_divisors := numelems(NumberTheory:-Divisors(i));
if num_divisors > max_divisors then
ap := [op(ap), i];
max_divisors := num_divisors;
end if;
end do;
 
return ap;
end proc:
antiprimes(20);</lang>
{{out}}
<pre>[1, 2, 4, 6, 12, 24, 36, 48, 60, 120, 180, 240, 360, 720, 840, 1260, 1680, 2520, 5040, 7560]</pre>
 
=={{header|Nim}}==
Anonymous user