Added prime-omega
This commit is contained in:
parent
1e52736089
commit
69f6d8ce52
|
@ -23,6 +23,7 @@
|
||||||
divisors
|
divisors
|
||||||
prime-divisors
|
prime-divisors
|
||||||
prime-exponents
|
prime-exponents
|
||||||
|
prime-omega
|
||||||
|
|
||||||
; roots
|
; roots
|
||||||
integer-root
|
integer-root
|
||||||
|
@ -489,6 +490,12 @@
|
||||||
(map (inst cadr N N (Listof N))
|
(map (inst cadr N N (Listof N))
|
||||||
(prime-divisors/exponents 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))
|
(: integer-root/remainder : N N -> (Values N N))
|
||||||
(define (integer-root/remainder a n)
|
(define (integer-root/remainder a n)
|
||||||
|
|
|
@ -539,6 +539,15 @@ all divisors of @racket[n].
|
||||||
(apply + (map sqr (divisors 12)))]
|
(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}
|
@section[#:tag "number-sequences"]{Number Sequences}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user