User:Danni0li v.2/sandbox

The number of seats per constituency is calculated by first figuring out the national quota by dividing the total legal population of Greece as recorded in the last census by the number of seats elected in constituencies (288). The integer of the division of the population of each constituency by the national quota, disregarding the decimals (marked $$k$$ in the function below), is the number of seats allocated to that constituency; a constituency with a sum of 5.6 is awarded 5 seats. If there are seats left empty in the first round of allocations, all 59 constituencies are ranked in descending order of leftover decimals ($k_1 \cdots k_{59}$) and a seat is awarded to any constituency with a $$k$$ larger than or equal to $k_x$, where $$x$$ is the number of seats which remained empty in the first allocation; if there are 9 unassigned seats, the constituencies with the 9 highest leftover decimals are awarded a seat each. The mathematical formula below is a summary of this allocation process:

$$\text{Constituency seats} = \left \lfloor {\text{(total legal population of the constituency)} \over \text{(total legal population of Greece)}/288} \right \rfloor \begin{cases} +1, & \text{if } k_n \geqslant k_x \\ +0, & \text{if } k_n < k_x \end{cases}$$

The use of integers only to determine the number of seats in the first allocation means that there are always seats left empty for allocation in the second step, since the number of seats allocated by rounding down is always less than the number of seats a constituency is entitled to. In the 2018 apportionment of seats, 263 seats were awarded to constituencies in the first step and 25 in the second; Evrytania and Lefkada received no seats in the first step, but received one seat each due to their leftover decimals in the second step.