I have played a game that have a mechanic of summation and want to write algorithm to calculate it
It is a game that let you grow an insect nest. It has Ant that give you 1 food per sec. Queen give you 1 Ant per sec. Nest give you 1 Queen per sec
And so for simplicity I would make it start with 1 nest the formula would be
$$\sum_{i=0}^s 1 = s\\\text{for Queen I would get from 1 nest}$$ $$\sum_{i=0}^s i = \frac{s^2 + s}{2}\\\text{for Ant I would get from queens hatched from 1 nest}$$ $$\sum_{i=0}^s \frac{i^2 + i}{2} = \frac{1}{2} (\sum_{i=0}^s i^2 + \sum_{i=0}^s i) = \frac{s^3 + 3s^2 + 2s}{6}\\\text{for Food I would get from ants hatched so far}$$
It seem like there should be able to write formula or algorithm for any depth. Are there any formula like that exist?