First we calculate the Basal Metabolic Rate (BMR)*:
Men: 10 x weight (kg) + 6.25 x height (cm) - 5 x age (y) + 5
Women: 10 x weight (kg) + 6.25 x height (cm) - 5 x age (y) - 161.
Next we multiply base rate by between 1.2 and 1.6 depending on exercise level.
Finaly we reduce by 15% for Fat Loss, or 25% for Fast Fat Loss. The 'absolute lowest' number of calories is capped at 8 calories per pound of body weight.
Gain weight steadily increases by 15%, Gain weight quickly increases by 25%.
* The formula, proposed by M.D. Mifflin and S.T. St Jeor, was found to be the most accurate by the American Dietetic Association in their 2005 comparison.