Product of divisors: Difference between revisions

Content added Content deleted
Line 1,091: Line 1,091:
One-liner version:
One-liner version:
<lang julia>proddivisors_oneliner(n) = prod(n%i==0 ? i : 1 for i in 1:n)</lang>
<lang julia>proddivisors_oneliner(n) = prod(n%i==0 ? i : 1 for i in 1:n)</lang>
It's shorter but with the cost of an higher complexity, <math>\Theta(m)</math> where m is the number of digits of n.


=={{header|Kotlin}}==
=={{header|Kotlin}}==