R/nStirling2.R

nStirling2 <-
function (n, k) {
  if (n<0) stop("n < 0")
  if (k<0) stop("k < 0")
  if (k>n) stop("k > n")
  m<-0;
  for (j in 0:k) m<-m+(-1)^(k-j)*choose(k,j)*j^n;
  return(m/factorial(k)); 
}

Try the kStatistics package in your browser

Any scripts or data that you put into this service are public.

kStatistics documentation built on June 8, 2022, 5:05 p.m.