Various useful number theoretic functions
1 2 3 4 5 6
factorize() cut-and-pasted from
Bill Venables's conf.design package, version 0.0-3. Function
primes(n) returns a vector of all primes not exceeding
factorize(n) returns an integer vector of
nondecreasing primes whose product is
The others are multiplicative functions, defined in Hardy and Wright:
divisor(), also written
sigma_k(n), is the divisor function defined on
p239. This gives the sum of the k-th powers of all
the divisors of
n. Setting k=0 corresponds to
d(n), which gives the number of divisors of
mobius() is the Moebius function (p234), giving zero
n has a repeated prime factor, and (-1)^q where
totient() is Euler's totient function (p52), giving
the number of integers smaller than
n and relatively prime to
liouville() gives the Liouville function.
The divisor function crops up in
Note that this function is not called
avoid conflicts with Weierstrass's sigma function (which
ought to take priority in this context).
Robin K. S. Hankin and Bill Venables (
G. H. Hardy and E. M. Wright, 1985. An introduction to the theory of numbers (fifth edition). Oxford University Press.
1 2 3 4 5 6 7 8 9
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.