Calmo numbers: Difference between revisions

m
no edit summary
mNo edit summary
Line 284:
957 [3 11 29 33 87 319] [43 439]
</pre>
 
=={{header|Julia}}==
<syntaxhighlight lang="julia">using Primes
 
function divisors(n::Integer)::Vector{Int}
sort(vec(map(prod,Iterators.product((p.^(0:m) for (p,m) in eachfactor(n))...))))
end
 
function isCalmo(n)
divi = divisors(n)[begin+1:end-1]
ndiv = length(divi)
(ndiv == 0 || ndiv % 3 != 0) && return false
return all(isprime, sum(reshape(divi, (3, :)), dims = 1))
end
 
println(filter(isCalmo, 1:1000))
</syntaxhighlight>
 
 
=={{header|Phix}}==
4,105

edits