I am working on a problem crop harvesting/sowing problem. A beet seed will yield 1 beet. Beets left in the ground will produce 3 seeds per beet to be replanted in the next season. I'm curious if there's a direct way to solve this like you can for an arithmetic series or something? What would this math area be called so that I can study further?
The problem is that if I want to sow enough seeds so that I can harvest $d$ beets, then I won't have any beets in the ground to produce seeds for the next season. I now need to plant enough beets to account for the extra beets needed to seed the next season. I played with this and got $d + d/3$. This gets me closer but now I have to account for the beets that result from $d/3$. This keeps getting closer but doesn't solve the problem since now I have to account for the beets, the additional beets for seeds and now the beets for that addition, and so on.
I noticed that this is really just repeatedly dividing the result of the previous result. This is where I started going with the math but I don't know what branch/topic of math this would be called to learn more about it. I simply can't stop accumulating partial results at hard coded amount of attempts as illustrated here:
$$ d + {{d + {{d + {d\over 3}}\over 3}}\over 3} $$
Depending on the size of $d$ this will start to lose seeds.
I didn't give up entirely though! I don't know how to continue the with the math so I came up with a recursive solution in code:
def seeds_needed need
seeds = need / 3.0
if seeds < 1
return 1 # because I can't use a partial seed :)
else
return seeds + seeds_needed(seeds)
end
en
This function gets me as close as I can. I pass it the number of beets I wish to harvest each year and it will return to me the number of seeds that I need to plant so that I can leave the extra beats in the ground to become seeds and start the process all over again.
Note: I do normalize the results later to account for the seeds being multiples of 3 per plant.