Calculates the allocation of seats in the House of Representatives based on the Jefferson, Hamilton, Webster, and Huntington-Hill methods of apportionment. You can read more about apportionment here.
The file apportionment.js contains the program in its entirety. It is currently configured to calculate seat assignments prior to the 1876 US election. Run it by typing "node apportionment.js" and the output will data in CSV format.
Edit the "totalSeats" and "data" variables in order to calculate apportionment for other years.
This program was used to do the research for this visualization of future electoral vote distribution and this article I wrote on how an apportionment error changed the outcome of the 1876 US presidential election.