Bodigrim / arithmoi

Number theory: primes, arithmetic functions, modular computations, special sequences
http://hackage.haskell.org/package/arithmoi
MIT License
147 stars 40 forks source link

Sort Gaussian primes by norm #122

Closed Bodigrim closed 6 years ago

Bodigrim commented 6 years ago

It is preferable for applications (e. g., trial division) to list Gaussian primes sorted by ascending norm. Currently this is not so:

> take 10 Math.NumberTheory.GaussianIntegers.primes
[1+ι,3,2+ι,1+2*ι,7,11,3+2*ι,2+3*ι,4+ι,1+4*ι]
> map norm $ take 10 Math.NumberTheory.GaussianIntegers.primes
[2,9,5,5,49,121,13,13,17,17]