Anti-primes: Difference between revisions
Content added Content deleted
m (→even and odd numbers: added wording to the section header.) |
(Add Maple implementation) |
||
Line 994: | Line 994: | ||
7560 |
7560 |
||
Done.</pre> |
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}}== |
=={{header|Nim}}== |