divisor {elliptic} | R Documentation |
Various useful number theoretic functions
divisor(n,k=1) primes(n) factorize(n) mobius(n) totient(n)
n |
Integer |
k |
Integer specifying second argument to sigma function |
Functions primes()
and factorize()
cut-and-pasted from
Bill Venebles's conf.design package, version 0.0-3. Function
primes(n)
returns a vector of all primes not exceeding
n
; function factorize(n)
returns an integer vector of
nondecreasing primes whose product is n
.
The others are multiplicative functions, defined in Hardy and Wright:
Function 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 n
.
mobius()
is the M"{o}bius function (p234), giving zero if
n
has a repeated prime factor, and (-1)^q where
n=p_1*p_2*...p_q otherwise.
totient()
is Euler's totient function (p52), giving the number
of integers smaller than n
and relatively prime to it.
The divisor function crops up in g2.fun()
and g3.fun()
.
Note that this function is not called sigma()
to
avoid conflicts with Weierstrass's sigma function (which
ought to take priority in this context).
Robin K. S. Hankin and Bill Venebles (primes()
and
factorize()
)
G. H. Hardy and E. M. Wright, 1985. An introduction to the theory of numbers (fifth edition). Oxford University Press.
mobius(1) mobius(2) divisor(140) divisor(140,3) plot(divisor(1:100,k=1),type="s",xlab="n",ylab="divisor(n,1)")