diff --git a/collects/math/private/number-theory/number-theory.rkt b/collects/math/private/number-theory/number-theory.rkt index 8b1d6864fb..f97d244905 100644 --- a/collects/math/private/number-theory/number-theory.rkt +++ b/collects/math/private/number-theory/number-theory.rkt @@ -23,6 +23,7 @@ divisors prime-divisors prime-exponents + prime-omega ; roots integer-root @@ -489,6 +490,12 @@ (map (inst cadr N N (Listof N)) (prime-divisors/exponents n))) +(: prime-omega : N -> N) +; http://reference.wolfram.com/mathematica/ref/PrimeOmega.html +(define (prime-omega n) + (for/fold: ([sum : Natural 0]) ([e (in-list (prime-exponents n))]) + (+ sum e))) + (: integer-root/remainder : N N -> (Values N N)) (define (integer-root/remainder a n) diff --git a/collects/math/scribblings/math-number-theory.scrbl b/collects/math/scribblings/math-number-theory.scrbl index aab9e239db..b46623abdf 100644 --- a/collects/math/scribblings/math-number-theory.scrbl +++ b/collects/math/scribblings/math-number-theory.scrbl @@ -539,6 +539,15 @@ all divisors of @racket[n]. (apply + (map sqr (divisors 12)))] } +@margin-note{OEIS: @hyperlink["http://oeis.org/A001222"]{Big Omega}} +@defproc[(prime-omega [n Natural]) natural?]{ +Counting multiplicities the number of prime factors of @racket[n] is returned. + +Note: The function @racket[prime-omega] is multiplicative. + +@interaction[#:eval untyped-eval + (prime-omega (* 2 2 2 3 3 4 5))] +} @; ---------------------------------------- @section[#:tag "number-sequences"]{Number Sequences}