Count in factors: Difference between revisions
Content deleted Content added
added a solution for Factor |
|||
Line 1,735:
=={{header|Julia}}==
-2 < n || return "-1"*SEP*factor_print(-n)▼
if isprime(n) || n < 2▼
join(a, SEP)▼
<lang julia>using Primes
lo = -4▼
function strfactor(n::Integer)
println("Factor print ", lo, " to ", hi)▼
for i in lo:hi▼
f = factor(Vector{typeof(n)}, n)
end
</lang>▼
▲lo, hi = -4, 40
@printf("%5d = %s\n", n, strfactor(n))
▲end</lang>
{{out}}
<pre>Factor print -4 to 40:▼
▲Factor print -4 to 40
-4 = -1 × 2 × 2
-3 = -1 × 3
Line 1,806 ⟶ 1,797:
38 = 2 × 19
39 = 3 × 13
40 = 2 × 2 × 2 × 5</pre>
=={{header|Kotlin}}==
|