Calories needed = Base_Cal + Distance_Cal + ElevationGain_Cal
Base_Cal = weight*10.872 (for women the factor is 9.785)
Distance_Cal = 100 cal/mi
ElevationGain_Cal = 0.2 cal/ft
A 150lb male hiking 10mi with 2500 elevation gain would need: 150*10.872 + 100*10 + 2500*0.2 = 3130 calories
A 150lb male hiking 20mi with 4000 elevation gain would need: 150*10.872 + 200*10 + 4000*0.2 = 4430 calories
Now, food provides calories. In general, food has fat, protein, carbs, and non-caloric elements (such as water, packaging, etc.). Although this is a simplification, we can assume the following calorie densities:
Fat: 9 cal/gr = 255 cal/oz
Protein: 4 cal/gr = 113 cal/oz
Carbs: 4 cal/gr = 113 cal/oz
Non-caloric: 0 cal/gr = 0 cal/oz
So, in a 10mi/2500ft hike, a 150lb male would need 12oz (0.75lb) of pure fat (yuck!) or 27oz (1.69lb) of pure carbs. Of course, on top of this you need to add the "non caloric" elements that add a surprising amoung of weight. For example:
Therefore, for the 10mi/2500ft hike, the 150lb male hiker will need to carry 2lb of food; for the 20mi/4000ft hike, the same person will need 2.75lb of food (or 1.30lb and 1.85lb respectively if we assume a density of 150 cal/oz).