JuliaMath / JuliaMath/Primes.jl

print(factor(24)) is not executable

Open
#132 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
108
Forks
34
PR merge metrics
No merged PRs in 30d

Description

playing around with `Factorizations` I noticed a bug

```
julia> print(factor(24))
Primes.Factorization(2 => 3, 3 => 1)
julia> Primes.Factorization(2 => 3, 3 => 1)
ERROR: MethodError: no method matching Primes.Factorization(::Pair{Int64, Int64}, ::Pair{Int64, Int64})
Stacktrace:
[1] top-level scope
@ REPL[3]:1
```

you should either print `factor(24)` as `Primes.Factorization(Dict(2 => 3, 3 => 1))` or add a method

`Primes.Factorization(l::Pair{T,Int}...) where T=Primes.Factorization(Dict(l))`

so that one can round-trip a `Factorization`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.