Rencontres Number

Count permutations of n labeled elements with exactly k fixed points using C(n,k)·D(n−k), returning zero for k>n; indices are capped at 1,000.

Description

Rencontres numbers count permutations with exactly a chosen number of fixed points.

Rencontres numbers count permutations with exactly a chosen number of fixed points. Choosing which elements remain fixed leaves a derangement of all remaining elements.1

The tool returns value. The indexing and output conventions below determine how to read these values.

When to use Rencontres Number

Use this for the following task: Count permutations of n labeled elements with exactly k fixed points using C(n,k)·D(n−k), returning zero for k>n; indices are capped at 1,000. Use the input and output conventions below to reproduce the intended mathematical quantity.

How to use Rencontres Number and understand its results

  1. Choose the required indexes, integers or sequence entries. Preserve decimal-string encodings where the field table specifies strings.
  2. Enter n, k according to the field table, then run the tool.
  3. Read value. Preserve exact decimal strings and the stated indexing or coefficient order.
  4. Keep exact decimal strings for subsequent integer arithmetic; distinguish them from any explicitly approximate numeric result.
Input fieldMeaningValue type and boundsRequirement
nPermutation size (resource limit 1000)integer; minimum 0; maximum 1000Required
kExact fixed-point count (resource limit 1000)integer; minimum 0; maximum 1000Required

Return zero when k>n. Otherwise compute the binomial coefficient and derangement with exact BigInt arithmetic and return their product as a decimal string.

D(n,k)=binomial(n,k)×derangement(n−k)

The symbols and boundary conditions refer to the supplied fields and the implementation described above.

Output fieldMeaningValue type
valueRencontres countstring (integer/arbitrary)
json
{
  "input": {
    "n": 5,
    "k": 2
  },
  "output": {
    "value": "20"
  }
}

Limitations and assumptions

Both indexes are at most 1000. The count concerns exactly k fixed points, not at least k; no permutations are returned.

Use the declared integer bounds and string formats. Large exact outputs remain decimal strings; numerical approximations use ordinary floating-point arithmetic. A rejected input is different from a valid zero count or false membership flag.

Alternative or Complementary methods

Choose Derangement Number when you need its operation: Count permutations of n labeled elements with no fixed points exactly, including one empty derangement; n is capped at 2,000. Choose Involution Number for the complementary operation: Count permutations of n labeled elements consisting only of fixed points and transpositions exactly, including the empty involution; n is capped at 2,000.

Background reference: OEIS A008290.

References

  1. OEIS A008290 — OEIS Foundation

Similar or alternative tools

  • Derangement Number

    Count permutations of n labeled elements with no fixed points exactly, including one empty derangement; n is capped at 2,000.

  • Involution Number

    Count permutations of n labeled elements consisting only of fixed points and transpositions exactly, including the empty involution; n is capped at 2,000.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies