Skip to content

Main content

Weak Composition Stars Bars Length Tool

Calculate weak composition stars bars length from explicit caller-supplied inputs.

Loading tool…

Description

Return stars-and-bars representation length for a weak composition.

Combinatorial counts depend on whether objects are labeled, order matters, repetitions are permitted and a prefix is already fixed. Local counts, exact integer factors and feasibility bounds answer specific questions and need not enumerate complete objects.

Return stars-and-bars representation length for a weak composition.

When to use this tool

Use Weak Composition Stars Bars Length when checking the stated word, set, multiset or composition convention.

How to use the tool and how it works

  1. Enter total, parts. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read stars, bars, length. Use the output convention below.

Return stars-and-bars representation length for a weak composition. Require whole total >= 0 and parts >= 1; stars = total, bars = parts-1, length = total+parts-1.1

Input fieldMeaning and unitsAccepted input
totalTotalRequired. Safe integer; minimum 0.
partsPartsRequired. Safe integer; minimum 1.
Output fieldInterpretationReturned shape
starsStarsRequired. Safe integer.
barsBarsRequired. Safe integer.
lengthLengthRequired. Safe integer.
json
{
  "input": {
    "total": 5,
    "parts": 3
  },
  "output": {
    "stars": 5,
    "bars": 2,
    "length": 7
  }
}

Limitations and assumptions

  • This is representation size, not the number of compositions; zero parts are rejected.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
  • Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.

Alternative or Complementary methods

Use complete objects and an appropriate exact counting, ranking or enumeration method when the local contribution is insufficient.

References

  1. Calculation and input contract: combinatorics/weak-composition-stars-bars-length — tool.io

Similar or alternative tools