Anti-primes: Difference between revisions
Content added Content deleted
(→{{header|Groovy}}: Initial solution) |
No edit summary |
||
Line 1,418: | Line 1,418: | ||
7560 |
7560 |
||
</pre> |
</pre> |
||
=={{header|Yabasic}}== |
|||
{{trans|AWK}} |
|||
<lang Yabasic>print "The first 20 anti-primes are:" |
|||
while (count < 20) |
|||
n = n + 1 |
|||
d = count_divisors(n) |
|||
if d > max_divisors then |
|||
print n; |
|||
max_divisors = d |
|||
count = count + 1 |
|||
end if |
|||
wend |
|||
print |
|||
sub count_divisors(n) |
|||
local count, i |
|||
if n < 2 return 1 |
|||
count = 2 |
|||
for i = 2 to n/2 |
|||
if not(mod(n, i)) count = count + 1 |
|||
next |
|||
return count |
|||
end sub</lang> |
|||
=={{header|zkl}}== |
=={{header|zkl}}== |
||
{{trans|Perl6}} |
{{trans|Perl6}} |