Whilst trying to optimize a simple tycoon type game I came across the following problem.
A factory is defined by 2 functions $P: \mathbb N \rightarrow \mathbb R$ and $C: \mathbb N \rightarrow \mathbb R$.
$P$ is how much earnings the factory makes given its level. For example $P(5) = 7.5$ , would mean that a level 5 factory would make $7.5\$/h$.
On the other hand, $C$ gives the cost of upgrading to the next level, So $C(4)=700$, would mean that to upgrade to level 4 from level 3 would take $700\$$.
My Question now is you start with a level 1 factory and every time you can afford an upgrade you purchase it, define $f$ as a function which gives you the level of the factory at a specific time given the previous strategy. How can $f$ be defined in terms of $P$ and $C$.
Let's instead define $C(n)$ to be the cost of upgrading from level n. Then, the time you spend in level n is $C(n)/P(n)$ and the time to get to level n is $$f(n) = \sum_{i = 1}^{n - 1}\frac{C(i)}{P(i)}$$ Without knowing C or P there's not much to say about f.