Showing posts with label SideTracked. Show all posts
Showing posts with label SideTracked. Show all posts

Saturday, February 18, 2012

Sometimes my friends make me do math

Could World's population fit within Nevada?

//Could you pack the world's population into nevada:
var nSurf_miles:Number = 110561;
var metersPerMile:Number = 609.344;
var nevadaSurfArea:Number = nSurf_miles * metersPerMile; //surface area of nevada in miles multiplied by meters per mile.
var nonPersonalSpace:Number = 0.3;    //0.3 meters is about 1FT. putting each person in a 1ftx1ft box.
var worldPop:Number = 6.995 * Math.pow(10,9); //(10^9);
trace("worldPop ==" + worldPop);
var linearSpace:Number = worldPop * nonPersonalSpace;
var surfArea:Number = Math.sqrt(linearSpace); //in meters squared.

trace("surfArea == " + surfArea);

if(surfArea <= nevadaSurfArea){
 trace("it could work");
}
UPDATE: According to one of my facebook programmer friends. My calculations are wrong. Here is his code.
local feet_per_mile = 5280
 
-- Surface area of Nevada, in square feet
local sqf_nevada = 110561 * feet_per_mile
 
-- According to the U.S. Census Bureau, the total population of the World,
-- projected to 02/19/12 at 12:00 UTC (EST+5) is
local pop_earth = 6995347552
print("If you tried to fit the entire population of the Earth into Nevada,")
print(string.format(
  "each person would have %.3f square inches of personal space!",
  (sqf_nevada/pop_earth)*12))