JuliaMath / JuliaMath/Primes.jl

Adding some multiplicative functions

Open
#68 6 comments 1 reaction 0 assignees View on GitHub
Dominant language
Julia
Stars
108
Forks
34
PR merge metrics
No merged PRs in 30d

Description

I am considering adding some basic prime-factorization-related functions to 'Primes.jl', in particular some [multiplicative functions]([https://en.wikipedia.org/wiki/Multiplicative_function](https://en.wikipedia.org/wiki/Multiplicative_function)) (in the sense of number theory, i.e, such that f(a*b) = f(a)f(b) if a and b are relative prime).

Primes.jl already has *totient* (but it does not appear to be documented; I might fix this). I would add at least the Möbius function, the divisor function, and the [Liouville function](https://en.wikipedia.org/wiki/Liouville_function). Some of these functions I have used to help solve Project Euler problems. In Python, such functions are provided by [SmyPy ](https://docs.sympy.org/latest/modules/ntheory.html).

Similar to the totient function I would add two versions each, to have efficiency in case the
factorization is already known, e.g.:
~~~Julia
moebiusmu(f::Factorization{T}) where T <: Integer
moebiusmu(n::Integer)
~~~

Also, I would add `divisors(n::Integer)` and `divisors(f::Factorization{T})` which return an array (or an iterator) giving all the positive divisors of n.

What do you think about this?

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.