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
- Enter firstVotes, secondVotes. Follow any array-alignment requirements below. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- 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 field | Meaning and units | Accepted input |
|---|---|---|
| firstVotes | First Votes | Required. Array of safe integer; maximum items 256. |
| secondVotes | Second Votes | Required. Array of safe integer; maximum items 256. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| prefixSurpluses | Prefix Surpluses | Required. Array of safe integer; maximum items 256. |
| allStrictlyPositive | True when every exact running surplus is >0; vacuously true for empty arrays. | Required. Boolean. |
{
"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
Similar or alternative tools
- Orbit Size Divisibility Remainder
Check divisibility of a group order by a proposed orbit size.
- Binomial Coefficient Symmetry Index
Calculate symmetric and smaller binomial-coefficient indices.