Skip to content

Main content

Ballot Prefix Surplus

Accumulate explicitly supplied paired vote-block counts into signed prefix surpluses without counting ballot arrangements.

Loading tool…

Description

Calculate exact cumulative supplied ballot surpluses and a strict-prefix flag.

Combinatorial checks often evaluate necessary conditions or one algebraic component. Parity can be combined from supplied signs, a divisibility test can constrain an orbit size, and prefix sums can enforce a strict positivity condition. Passing one condition does not construct or prove the existence of the full combinatorial object.

Calculate exact cumulative supplied ballot surpluses and a strict-prefix flag.

When to use this tool

Use Ballot Prefix Surplus when you already have firstVotes, secondVotes and need to calculate exact cumulative supplied ballot surpluses and a strict-prefix flag.

How to use the tool and how it works

  1. Enter firstVotes, secondVotes. Follow any array-alignment requirements below. 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 prefixSurpluses, allStrictlyPositive. Inspect allStrictlyPositive before interpreting the associated values.

Require aligned arrays of nonnegative safe counts; accumulate first-second with BigInt, requiring every prefix to fit the safe range. Return prefixes and whether each is >0.1

Input fieldMeaning and unitsAccepted input
firstVotesFirst VotesRequired. Array of safe integer; maximum items 256.
secondVotesSecond VotesRequired. Array of safe integer; maximum items 256.
Output fieldInterpretationReturned shape
prefixSurplusesPrefix SurplusesRequired. Array of safe integer; maximum items 256.
allStrictlyPositiveTrue when every exact running surplus is >0; vacuously true for empty arrays.Required. Boolean.
json
{
  "input": {
    "firstVotes": [
      2,
      1,
      0
    ],
    "secondVotes": [
      0,
      1,
      1
    ]
  },
  "output": {
    "prefixSurpluses": [
      2,
      2,
      1
    ],
    "allStrictlyPositive": true
  }
}

Limitations and assumptions

  • Empty arrays return allStrictlyPositive=true by vacuous truth. A zero prefix fails; no ballot validity, election outcome, probability or actual votes are verified.
  • 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.

Alternative or Complementary methods

Use a complete construction, enumeration or proof for the mathematical question. Keep integer ranges, empty-input conventions and strict inequalities explicit when incorporating these local checks into a larger algorithm.

References

  1. Calculation and input contract: combinatorics/ballot-prefix-surplus — tool.io

Similar or alternative tools