<!-- canonical: efficientnewlanguage.org/ai/examples/872-the-extra-seat-took-one-away | ai_layer_version: 0.1.0 | updated: 2026-09-16 -->

# Example 872 — The extra seat took one away

`the_extra_seat_took_one_away.eml` - Seats are shared among three regions by the largest-remainder rule: each region gets the whole part of its exact share, and the seats left over go to the largest fractional remainders. The rule is applied exactly to the real populations. What happens to the smallest region when the house grows by one seat is computed below.

## EML

```eml
# Self-authored for the EML case corpus (no external origin). Seats are shared
# among three regions by the largest-remainder rule: each region gets the whole
# part of its exact share, and the seats left over go to the largest fractional
# remainders. The rule is applied exactly to the real populations. What happens to
# the smallest region when the house grows by one seat is computed below.
#
# The apportionment is careful. It uses the real populations, not estimates; the
# exact shares are computed to the thousandth; the whole parts and the remainders
# are honest; and the intent is exactly 'seats in proportion to population, and
# more seats never means fewer for anyone'.
#
# Largest-remainder is not monotone in the size of the house: the small region's
# remainder is the largest at ten seats and the smallest at eleven, so adding a
# seat to the house takes one from it.

600 => population_a
600 => population_b
200 => population_c
10 => seats_before
11 => seats_after

population_a + population_b + population_c => population_total
int(population_a * seats_before * 1000 / population_total) => quota_a_before_thousandths
int(population_c * seats_before * 1000 / population_total) => quota_c_before_thousandths
int(quota_a_before_thousandths / 1000) => floor_a_before
int(quota_c_before_thousandths / 1000) => floor_c_before
quota_a_before_thousandths - floor_a_before * 1000 => remainder_a_before
quota_c_before_thousandths - floor_c_before * 1000 => remainder_c_before
2 * floor_a_before + floor_c_before => floors_total_before
seats_before - floors_total_before => leftover_seats_before
int(population_a * seats_after * 1000 / population_total) => quota_a_after_thousandths
int(population_c * seats_after * 1000 / population_total) => quota_c_after_thousandths
int(quota_a_after_thousandths / 1000) => floor_a_after
int(quota_c_after_thousandths / 1000) => floor_c_after
quota_a_after_thousandths - floor_a_after * 1000 => remainder_a_after
quota_c_after_thousandths - floor_c_after * 1000 => remainder_c_after
2 * floor_a_after + floor_c_after => floors_total_after
seats_after - floors_total_after => leftover_seats_after
floor_c_before + 1 => seats_c_before
floor_c_after => seats_c_after
seats_c_before - seats_c_after => seats_c_lost_by_growing_the_house

"populations A, B, C             : " + str(population_a) + ", " + str(population_b) + ", " + str(population_c) ^0
"" ^0
"house of " + str(seats_before) + " seats" ^0
"  exact share A (thousandths)   : " + str(quota_a_before_thousandths) + "  whole " + str(floor_a_before) + "  remainder " + str(remainder_a_before) ^0
"  exact share C (thousandths)   : " + str(quota_c_before_thousandths) + "  whole " + str(floor_c_before) + "  remainder " + str(remainder_c_before) ^0
"  whole parts total             : " + str(floors_total_before) + "  leftover seats " + str(leftover_seats_before) ^0
"  largest remainder             : C, so C gets the leftover seat" ^0
"  seats                         : A " + str(floor_a_before) + ", B " + str(floor_a_before) + ", C " + str(seats_c_before) ^0
"" ^0
"house of " + str(seats_after) + " seats" ^0
"  exact share A (thousandths)   : " + str(quota_a_after_thousandths) + "  whole " + str(floor_a_after) + "  remainder " + str(remainder_a_after) ^0
"  exact share C (thousandths)   : " + str(quota_c_after_thousandths) + "  whole " + str(floor_c_after) + "  remainder " + str(remainder_c_after) ^0
"  whole parts total             : " + str(floors_total_after) + "  leftover seats " + str(leftover_seats_after) ^0
"  largest remainders            : A and B, so they get the two leftover seats" ^0
"  seats                         : A " + str(floor_a_after + 1) + ", B " + str(floor_a_after + 1) + ", C " + str(seats_c_after) ^0
"" ^0
"C, seats before and after       : " + str(seats_c_before) + " then " + str(seats_c_after) ^0
"C lost by the house growing     : " + str(seats_c_lost_by_growing_the_house) + " seat" ^0
"" ^0

# ---- what the apportionment verified ----

"the largest-remainder apportionment" ^0
"  uses : the real populations, not estimates" ^0
"  shares : computed exactly, to the thousandth" ^0
"  whole parts and remainders : honest" ^0
"  intent : seats in proportion, and more seats never fewer" ^0
"    for anyone" ^0
"  regions misallocated : 0" ^0
"  verdict : EVERY SEAT ASSIGNED BY THE RULE, BOTH TIMES" ^0
"" ^0
"  computing the exact shares and following the rule to the" ^0
"  letter is the part done right here, and it is why both" ^0
"  allocations are correct applications of the rule" ^0
"" ^0

# ---- why the small region lost a seat ----

"what growing the house does to the remainders" ^0
"  every share grows by one tenth of itself" ^0
"  a large share's remainder : grows a lot, " + str(remainder_a_before) + " to " + str(remainder_a_after) ^0
"  a small share's remainder : grows a little, " + str(remainder_c_before) + " to " + str(remainder_c_after) ^0
"  at " + str(seats_before) + " seats : C's remainder is the largest, C gets the spare" ^0
"  at " + str(seats_after) + " seats : C's remainder is the smallest, A and B get" ^0
"    the two spares" ^0
"  so C : from " + str(seats_c_before) + " seats to " + str(seats_c_after) + ", with one more seat to share" ^0
"" ^0

# ---- what the regions got ----

"the outcome" ^0
"  seats added to the house : 1" ^0
"  seats C lost : " + str(seats_c_lost_by_growing_the_house) ^0
"  is either allocation against the rule : no; both are exact" ^0
"  does more seats mean no one loses : not under this rule;" ^0
"    the remainders reorder as the house grows" ^0
"" ^0

# ---- null control ----

# The same populations, apportioned by a divisor method (adjust one divisor until
# the rounded shares sum to the house), which is monotone in house size.
1 => nc_seats_c_lost_under_largest_remainder
0 => nc_seats_c_lost_under_a_divisor_method
3 => nc_regions_the_divisor_method_keeps_whole

"null control - apportion by a divisor method" ^0
"  seats C lost, largest remainder : " + str(nc_seats_c_lost_under_largest_remainder) ^0
"  seats C lost, divisor method : " + str(nc_seats_c_lost_under_a_divisor_method) ^0
"  regions that never lose a seat to growth : " + str(nc_regions_the_divisor_method_keeps_whole) + " of 3" ^0
"  no population and no seat count changed; the rule stopped" ^0
"  letting the remainders reorder" ^0
"" ^0

# ---- the rule ----

"what a largest-remainder apportionment guarantees" ^0
"  every seat goes to a whole part or a largest remainder :" ^0
"    exactly, real populations, exact shares, the rule to the" ^0
"    letter" ^0
"  adding a seat never costs a region a seat : not" ^0
"    addressed; the remainders reorder as the house grows, so" ^0
"    C holds " + str(seats_c_before) + " seats of " + str(seats_before) + " and " + str(seats_c_after) + " of " + str(seats_after) ^0
"" ^0

"a rule that hands out the spares by fractional remainder is deciding by the part" ^0
"of each share that changes fastest when the house changes; the small region's" ^0
"fraction cannot keep pace, so the seat added to the house is paid for by the" ^0
"region least able to spare it" ^0
"" ^0

"It computes exact shares and applies the largest-remainder rule to the letter -" ^0
"both allocations are correct. But the rule is not monotone in house size: C's" ^0
"remainder is largest at " + str(seats_before) + " seats and smallest at " + str(seats_after) + ", so C holds " + str(seats_c_before) + " seats" ^0
"then " + str(seats_c_after) + ", losing " + str(seats_c_lost_by_growing_the_house) + " to a house that grew, until a divisor method is used." ^0
```

## Python (deterministic transpilation)

```python
population_a = 600
population_b = 600
population_c = 200
seats_before = 10
seats_after = 11
population_total = population_a + population_b + population_c
quota_a_before_thousandths = int(population_a * seats_before * 1000 / population_total)
quota_c_before_thousandths = int(population_c * seats_before * 1000 / population_total)
floor_a_before = int(quota_a_before_thousandths / 1000)
floor_c_before = int(quota_c_before_thousandths / 1000)
remainder_a_before = quota_a_before_thousandths - floor_a_before * 1000
remainder_c_before = quota_c_before_thousandths - floor_c_before * 1000
floors_total_before = 2 * floor_a_before + floor_c_before
leftover_seats_before = seats_before - floors_total_before
quota_a_after_thousandths = int(population_a * seats_after * 1000 / population_total)
quota_c_after_thousandths = int(population_c * seats_after * 1000 / population_total)
floor_a_after = int(quota_a_after_thousandths / 1000)
floor_c_after = int(quota_c_after_thousandths / 1000)
remainder_a_after = quota_a_after_thousandths - floor_a_after * 1000
remainder_c_after = quota_c_after_thousandths - floor_c_after * 1000
floors_total_after = 2 * floor_a_after + floor_c_after
leftover_seats_after = seats_after - floors_total_after
seats_c_before = floor_c_before + 1
seats_c_after = floor_c_after
seats_c_lost_by_growing_the_house = seats_c_before - seats_c_after
print("populations A, B, C             : " + str(population_a) + ", " + str(population_b) + ", " + str(population_c))
print("")
print("house of " + str(seats_before) + " seats")
print("  exact share A (thousandths)   : " + str(quota_a_before_thousandths) + "  whole " + str(floor_a_before) + "  remainder " + str(remainder_a_before))
print("  exact share C (thousandths)   : " + str(quota_c_before_thousandths) + "  whole " + str(floor_c_before) + "  remainder " + str(remainder_c_before))
print("  whole parts total             : " + str(floors_total_before) + "  leftover seats " + str(leftover_seats_before))
print("  largest remainder             : C, so C gets the leftover seat")
print("  seats                         : A " + str(floor_a_before) + ", B " + str(floor_a_before) + ", C " + str(seats_c_before))
print("")
print("house of " + str(seats_after) + " seats")
print("  exact share A (thousandths)   : " + str(quota_a_after_thousandths) + "  whole " + str(floor_a_after) + "  remainder " + str(remainder_a_after))
print("  exact share C (thousandths)   : " + str(quota_c_after_thousandths) + "  whole " + str(floor_c_after) + "  remainder " + str(remainder_c_after))
print("  whole parts total             : " + str(floors_total_after) + "  leftover seats " + str(leftover_seats_after))
print("  largest remainders            : A and B, so they get the two leftover seats")
print("  seats                         : A " + str(floor_a_after + 1) + ", B " + str(floor_a_after + 1) + ", C " + str(seats_c_after))
print("")
print("C, seats before and after       : " + str(seats_c_before) + " then " + str(seats_c_after))
print("C lost by the house growing     : " + str(seats_c_lost_by_growing_the_house) + " seat")
print("")
print("the largest-remainder apportionment")
print("  uses : the real populations, not estimates")
print("  shares : computed exactly, to the thousandth")
print("  whole parts and remainders : honest")
print("  intent : seats in proportion, and more seats never fewer")
print("    for anyone")
print("  regions misallocated : 0")
print("  verdict : EVERY SEAT ASSIGNED BY THE RULE, BOTH TIMES")
print("")
print("  computing the exact shares and following the rule to the")
print("  letter is the part done right here, and it is why both")
print("  allocations are correct applications of the rule")
print("")
print("what growing the house does to the remainders")
print("  every share grows by one tenth of itself")
print("  a large share's remainder : grows a lot, " + str(remainder_a_before) + " to " + str(remainder_a_after))
print("  a small share's remainder : grows a little, " + str(remainder_c_before) + " to " + str(remainder_c_after))
print("  at " + str(seats_before) + " seats : C's remainder is the largest, C gets the spare")
print("  at " + str(seats_after) + " seats : C's remainder is the smallest, A and B get")
print("    the two spares")
print("  so C : from " + str(seats_c_before) + " seats to " + str(seats_c_after) + ", with one more seat to share")
print("")
print("the outcome")
print("  seats added to the house : 1")
print("  seats C lost : " + str(seats_c_lost_by_growing_the_house))
print("  is either allocation against the rule : no; both are exact")
print("  does more seats mean no one loses : not under this rule;")
print("    the remainders reorder as the house grows")
print("")
nc_seats_c_lost_under_largest_remainder = 1
nc_seats_c_lost_under_a_divisor_method = 0
nc_regions_the_divisor_method_keeps_whole = 3
print("null control - apportion by a divisor method")
print("  seats C lost, largest remainder : " + str(nc_seats_c_lost_under_largest_remainder))
print("  seats C lost, divisor method : " + str(nc_seats_c_lost_under_a_divisor_method))
print("  regions that never lose a seat to growth : " + str(nc_regions_the_divisor_method_keeps_whole) + " of 3")
print("  no population and no seat count changed; the rule stopped")
print("  letting the remainders reorder")
print("")
print("what a largest-remainder apportionment guarantees")
print("  every seat goes to a whole part or a largest remainder :")
print("    exactly, real populations, exact shares, the rule to the")
print("    letter")
print("  adding a seat never costs a region a seat : not")
print("    addressed; the remainders reorder as the house grows, so")
print("    C holds " + str(seats_c_before) + " seats of " + str(seats_before) + " and " + str(seats_c_after) + " of " + str(seats_after))
print("")
print("a rule that hands out the spares by fractional remainder is deciding by the part")
print("of each share that changes fastest when the house changes; the small region's")
print("fraction cannot keep pace, so the seat added to the house is paid for by the")
print("region least able to spare it")
print("")
print("It computes exact shares and applies the largest-remainder rule to the letter -")
print("both allocations are correct. But the rule is not monotone in house size: C's")
print("remainder is largest at " + str(seats_before) + " seats and smallest at " + str(seats_after) + ", so C holds " + str(seats_c_before) + " seats")
print("then " + str(seats_c_after) + ", losing " + str(seats_c_lost_by_growing_the_house) + " to a house that grew, until a divisor method is used.")
```

## stdout (executed)

```text
populations A, B, C             : 600, 600, 200

house of 10 seats
  exact share A (thousandths)   : 4285  whole 4  remainder 285
  exact share C (thousandths)   : 1428  whole 1  remainder 428
  whole parts total             : 9  leftover seats 1
  largest remainder             : C, so C gets the leftover seat
  seats                         : A 4, B 4, C 2

house of 11 seats
  exact share A (thousandths)   : 4714  whole 4  remainder 714
  exact share C (thousandths)   : 1571  whole 1  remainder 571
  whole parts total             : 9  leftover seats 2
  largest remainders            : A and B, so they get the two leftover seats
  seats                         : A 5, B 5, C 1

C, seats before and after       : 2 then 1
C lost by the house growing     : 1 seat

the largest-remainder apportionment
  uses : the real populations, not estimates
  shares : computed exactly, to the thousandth
  whole parts and remainders : honest
  intent : seats in proportion, and more seats never fewer
    for anyone
  regions misallocated : 0
  verdict : EVERY SEAT ASSIGNED BY THE RULE, BOTH TIMES

  computing the exact shares and following the rule to the
  letter is the part done right here, and it is why both
  allocations are correct applications of the rule

what growing the house does to the remainders
  every share grows by one tenth of itself
  a large share's remainder : grows a lot, 285 to 714
  a small share's remainder : grows a little, 428 to 571
  at 10 seats : C's remainder is the largest, C gets the spare
  at 11 seats : C's remainder is the smallest, A and B get
    the two spares
  so C : from 2 seats to 1, with one more seat to share

the outcome
  seats added to the house : 1
  seats C lost : 1
  is either allocation against the rule : no; both are exact
  does more seats mean no one loses : not under this rule;
    the remainders reorder as the house grows

null control - apportion by a divisor method
  seats C lost, largest remainder : 1
  seats C lost, divisor method : 0
  regions that never lose a seat to growth : 3 of 3
  no population and no seat count changed; the rule stopped
  letting the remainders reorder

what a largest-remainder apportionment guarantees
  every seat goes to a whole part or a largest remainder :
    exactly, real populations, exact shares, the rule to the
    letter
  adding a seat never costs a region a seat : not
    addressed; the remainders reorder as the house grows, so
    C holds 2 seats of 10 and 1 of 11

a rule that hands out the spares by fractional remainder is deciding by the part
of each share that changes fastest when the house changes; the small region's
fraction cannot keep pace, so the seat added to the house is paid for by the
region least able to spare it

It computes exact shares and applies the largest-remainder rule to the letter -
both allocations are correct. But the rule is not monotone in house size: C's
remainder is largest at 10 seats and smallest at 11, so C holds 2 seats
then 1, losing 1 to a house that grew, until a divisor method is used.
```

## Round-trip

`ok: true` — round-trip fixpoint reached (python1 == python2)

## Trace event types

eml:run:start · eml:assign · eml:output · eml:run:done
