Is there a closed form for the growing of the population of Minecraft cow? [duplicate]
Solution 1:
This is OEISA061418, interestingly the "example" is about Minecraft. The given solution for the $n$th term is
$$ a(n) = \lceil K*(3/2)^n \rceil $$
where $K=1.0815136685\dots$ and $K=(2/3) K(3)$ where the decimal expansion of $K(3)$ is here.
For clarification as to how this formula is used, suppose you want to know how many cows you have after the $10$th breeding cycle. First,
$$ K*(3/2)^n = (1.0815136685)*(3/2)^{10} \approx 62.3655 $$
Now we have to take the ceiling of this number, which just means rounding it up to the nearest integer. Therefore,
$$ a(10) = \lceil K*(3/2)^n \rceil = \lceil 62.3655 \rceil = 63 $$
which agrees with the sequence. Note that for very large $n$, you may need to use a more exact value of $K$ (which is why I posted that second link.)
Solution 2:
What you are looking for is the solution to the recurrence: $$T(1) = 2$$ $$T(n) = T(n-1) + \left\lfloor \frac{T(n-1)}{2} \right\rfloor$$ Indeed this function grows as an exponential, since it behaves asymptotically like $$T(n) \approx 2 \left( \frac{3}{2} \right)^{n - 1}$$ Since $T(n)$ is always an integer, we can rewrite the recurrence as $$T(n) = \left\lfloor \frac{3}{2} T(n-1) \right \rfloor$$ This gives an efficient way to compute $T(n)$ iteratively. I'm not sure there is a useful closed form.
Solution 3:
To restate what you've written: at each stage, if $N$ is the number of cows before breeding, then the number of additional cows is $\lfloor N/2 \rfloor$ (see the floor function defined here).
As a recurrence relation, we can state the following:
Let $N(k)$ be the number of cows after $k$ stages of breeding. Then $N$ satisfies the recurrence relation $$ N(k+1) = N(k) + \lfloor N(k)/2 \rfloor $$ With $N(0) = 2$. I'm not sure if there's a neat non-recursive expression for $N$ as a function of $k$, but at the very least this is a start.