Ikariam:Building resources formula

Generalized Formula
The formula that gives the building resources for a given level is :

$$ Resources = round(\frac{A}{B}\times C^{level-n_0}-D) $$

Coefficients
Here is the non-exhaustive list of the coefficients:

Remarks
A and B is actually one coefficient but having a fraction of natural numbers gives unlimited precision. The coefficient C is the most important, its value strongly influences the needed resources. Not surprisingly, it takes the highest values for Palace and Museum. n0 represents the last level before the resource is needed : for Wood needs, n0 is always set at 0 (except for the Town hall) but for example, Marble is not needed for building Barracks until level 9, thus n0 equals 8.

Example
We would like to know the amount of Wood needed for the 20th level of the Museum Museum Wood:( A, B , C , D , n0 ) = ( 3500 , 3 , 1.5 , 1190 , 0 )

$$ ~Resources = round(\frac{A}{B}\times C^{level-n_0}-D) $$

$$ ~Wood_{level20} = round( \frac{3,500}{3} \times 1.5^{20-0}-1,190) $$

$$ ~Wood_{level20} = round(3,878,276.185) $$

$$ ~Wood_{level20} = 3,878,276 $$

When reductions occur such as Pulley, Geometry, Spirit level or Carpenter, the original value is reduced then rounded down :

For the 20th level of the Museum with Pulley, Geometry, Spirit level and a Carpenter level 32:

$$ ~ Wood_{level20} = rounddown(3,878,276 \times (0.54)) $$

$$ ~ Wood_{level20} = rounddown(2,094,269.04) $$

$$ ~ Wood_{level20} = 2,094,269 $$

I couldn't (yet) find the values for Academy, Temple, Town Hall, Trading port, Trading post, Wood needs for Carpenter and Marble needs for Architect's Office because it looks like the formula is a little bit different, I haven't figured out how yet.

Probable mistake in the Game
Regarding the Dump, I claim that mistakes have been made by Gameforge for the following values :

Level 5 - : the formula gives 2765 but the actual value is 2762

Level 6 - : the formula gives 3826 but the actual value is 3526

Level 29 - : the formula gives 210717 but the actual value is 201717

There are obviously typing mistakes, but I have no idea how to inform the right people about this matter.