Permutations Calculator
This program computes the total count of all possible unique permutations (unique ordered sequences) of (N) distinct objects if taken in random groups of (R) at a time.

NOTE:
Since the program computes the EXACT value and performs all of its computations in arbitrary-precision, in some cases, the computed values may extend out to tens of thousands of digits and could possibly take up to several seconds to return the computed result.




N (0  to  9999) =            R (0  to  N) =        


The EXACT value of P(1, 1) is computed below and consists of 1 digit.




Permutations are ordered sequences, so the number of permutations means the number of unique ordered sequences in which (R) distinct items may be drawn from a total pool of (N) distinct items.  For example we could compute the total number of possible unique numbers we could create using 5 different digits from a pool of N unique digits.

All permutations of unique items are unique sequences.  Any two sets containing the same (R) items, such as a sequence of numerical digits, are considered identical only if all the digits in both numbers were selected in the same order as well.  The symbols are not limited only to numerical digits, they can be letters or any other unique objects as well.

The number 12345 is not identical to 54321 or any other permutations of the same digits.  Its value may be one out of many, but it is still unique among all the possible permutations.


Below is a listing of the PHP function at the heart of the above Permutations Calculator program.  It computes the total number of possible unique sequences (permutations) in arbitrary-precision, which could extend out to several thousands of digits.
/*
  ===========================================================================
  This function returns the EXACT count of unique permutations of (N) items
  that are possible, selected in random groups of (R) at a time.

  NOTE:  In permutations, the sequential order of the items in each group
         IS important.

  Author   : Jay Tanner 2024
  Language : PHP v7.x
  ===========================================================================
*/

  function bcPerm_N_R ($N, $R)
{
  $P=1; for ($i=0;  $i < $R;  $i++) {$P = bcmul($P, $N-$i);}

  return $P;
}



Jay Tanner - 2024