Added prime-omega

This commit is contained in:
Jens Axel Søgaard 2012-11-17 22:35:12 +01:00 committed by Neil Toronto
parent 1e52736089
commit 69f6d8ce52
2 changed files with 16 additions and 0 deletions

View File

@ -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)

View File

@ -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}