Largest remainder seat allocation free
Turn vote totals into whole seats with the largest remainder method: 416000, 338000 and 246000 votes for 10 seats under the Hare quota give 4, 3 and 3 seats. Pick the Hare or the Droop quota and see each party's remainder. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Votes per party
- 416,000, 338,000, 246,000
- Seats to allocate
- 10
- Party names (optional)
- A, B, C
- Quota method
- Hare (total votes ÷ seats)
- Quota method
- Hare
- Electoral quota
- 100,000
Allocates seats by the largest remainder method (Hamilton) with Hare or Droop quota. Free, deterministic, and private in your browser. No account required. No account required.
How seats are shared by largest remainder
Proportional systems need whole seats, but votes almost never divide evenly. The largest remainder method, also known as the Hamilton method, settles this in two rounds. First it sets a quota, the number of votes that is worth one seat, and gives each party as many seats as it has full quotas, always rounding down. Then the seats still unassigned go one by one to the parties with the largest leftover fractions. In the example, 10 seats are shared among 416000, 338000 and 246000 votes. With a Hare quota of 100000, the first round gives 4, 3 and 2 seats, which leaves one seat open. The remainders are 0.16, 0.38 and 0.46, so the last seat goes to the third party and the final split is 4, 3 and 3.
Mistakes to avoid when you check an allocation
Most errors happen in the first round. Rounding to the nearest whole number instead of down breaks the method, because that round may only hand out full quotas. Giving the leftover seats to the biggest parties instead of the biggest remainders changes the outcome, as the third party in the example shows. The quota matters too: check whether your rules call for the Hare or the Droop quota before comparing results. The calculator is useful for homework and exam problems on electoral systems, where you want a stable answer to compare yours against.
What you can do with it
Homework and exams
Check classic quantitative problems quickly with stable, reproducible answers.
Automation
Call the same pure function from scripts without installing a spreadsheet or CAS.
FAQ
Is this free?
Yes. Tier A runs entirely in your browser without an account.
How does the largest remainder method allocate seats?
First every party gets one seat for each full quota of votes, always rounding down. The seats left over then go one at a time to the parties with the largest leftover fractions until every seat is filled.
Why does a party with fewer full quotas win the last seat?
Because leftover seats follow the remainders, not the vote totals. In the example the third party has only 2 full quotas, but its remainder of 0.46 is the largest, so the last of the 10 seats goes to it and it ends with 3.
Which quota can I use?
You can choose the Hare quota or the Droop quota. With Hare, the example's one million votes shared among 10 seats give a quota of 100000 votes per seat, and every allocation starts from that figure.
Can I give the parties names?
Yes. Add one name per party in the same order as the votes, and the result lists every party by name with its votes, its seats and its remainder, as A, B and C do in the example.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/math/largest-remainder \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"votes":[416000,338000,246000],"seats":10}'const res = await fetch("https://api.kit.forhosting.com/math/largest-remainder", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"votes": [
416000,
338000,
246000
],
"seats": 10
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/largest-remainder",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"votes": [
416000,
338000,
246000
],
"seats": 10
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/largest-remainder", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"votes":[416000,338000,246000],"seats":10}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"votes":[416000,338000,246000],"seats":10}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/largest-remainder", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"votes": [
416000,
338000,
246000
],
"seats": 10
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.largest_remainder",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
How it works
Each party gets floor(votes/quota) seats, then remaining seats go to the largest fractional remainders in order. The implementation is fully deterministic and runs free in the browser with the same pure function as the API path. Inputs are validated before any arithmetic so wrong types and out-of-range values become clear invalid_input errors instead of silent NaN results. The implementation is fully deterministic and runs free in the browser with the same pure function as the API path. Inputs are validated before any arithmetic so wrong types and out-of-range values become clear invalid_input errors instead of silent NaN results. The implementation is fully deterministic and runs free in the browser with the same pure function as the API path. Inputs are validated before any arithmetic so wrong types and out-of-range values become clear invalid_input errors instead of silent NaN results.
Inputs and outputs
Required fields must be present and correctly typed. Optional fields use documented defaults. Error messages use stable English match substrings for the harness. Allocates seats by the largest remainder method (Hamilton) with Hare or Droop quota. Provide the fields listed in the input schema. The success payload always includes the primary result fields named in the output schema so clients can bind UI metrics without guessing. The implementation is fully deterministic and runs free in the browser with the same pure function as the API path. Inputs are validated before any arithmetic so wrong types and out-of-range values become clear invalid_input errors instead of silent NaN results. The implementation is fully deterministic and runs free in the browser with the same pure function as the API path. Inputs are validated before any arithmetic so wrong types and out-of-range values become clear invalid_input errors instead of silent NaN results.
Edge cases and limits
Rejects zero total votes and invalid quota names. Empty or contradictory ranges are rejected early. Extremely large intermediate values that overflow IEEE-754 become an out-of-range error rather than null fields. The implementation is fully deterministic and runs free in the browser with the same pure function as the API path. Inputs are validated before any arithmetic so wrong types and out-of-range values become clear invalid_input errors instead of silent NaN results. The implementation is fully deterministic and runs free in the browser with the same pure function as the API path. Inputs are validated before any arithmetic so wrong types and out-of-range values become clear invalid_input errors instead of silent NaN results.
Integration use cases
Teaching demos
Show worked examples with golden fixtures that match the free widget and the API.
Technical questions
Does it call the network?
No. The parse engine keeps everything on-device.
What if my input is invalid?
You receive invalid_input with a clear English message.
Are results stable?
Yes. Deterministic math and golden examples freeze the contract.
Who authors this capacity?
samurai on the ForHosting KIT workshop.