Calculates the number of permutations for a given set of data.

View versions (1)

Interface

#include <codecogs/statistics/moments/permut.h>

using namespace Statistics::Moments;

Returns the <em>number of permutations</em> for a given number of objects that can be selected from number objects.

A permutation is any set or subset of objects or events where internal order is significant.

Permutations are different from combinations, for which the internal order is not significant. Use this function for lottery-style probability calculations. The equation for the number of permutations is:

P(N,k)=\frac{N!}{(N-k)!}
(1)

Example 1

#include <codecogs/statistics/moments/permut.h>
#include <iostream>
int main()
{
  double per = Stats::Moments::permut(6, 2);
  std::cout << "The number of permutations is: " << per<< std::endl;
  return 0;
}

Output:

The number of permutations is: 30

Parameters

n
is an integer that describes the number of objects
k
is an integer that describes the number of objects in each permutation.

Returns

the number of permutations for a given set of data
GPL Licence — free for non commercial use. See Licence details.

Interactive Calculator

n
k
Result