Ok, so I have a game where you have 3 stats: agility, strength, and stamina. I'll avoid going into tons of detail about the game, so here's the gist of the math:
Each stat starts at 1. Every time you send a message, there is a random chance for a stat to increase by 1. The chance is calculated as follows:
First: The stat to try and increase is randomly selected. Equal probabilities.
Second: If the stat is at its cap (200), then nothing happens. No stats gained. Otherwise, the stat has a random chance equal to (200 - current stat) / 200 of increasing by 1.
What I want to know is, how many messages will it take, on average, for the stat to hit max? If you can tell me the same info with a starting stat of 200 each, and cap of 455 each, that would be lovely as well. If your formula applies to both, I can... probably use it? It's almost 2am, I'm kinda fried. Not sure what to tag. Anywho, thanks :) hope this is fun.
Okay, I think I figured this out on my own (after sleeping haha). I was really tired so I had to stupid-simple explain it to myself, and I'll write that here for fun and for the tired readers.
When you flip a coin, you have a 1/2 chance of getting heads. That means, for every 2 flips, you get 1 heads. 2 flips / 1 heads = 2 flips per head.
When you get a stat increase, you have a
(200 - current stat) / 200chance of getting the stat to increase by 1. So, for every 200 opportunities, you will get(200 - current stat)increases.200 messages / (200 - current stat) stats= X messages per stat.So, when my stat is 1, it's (200/199) messages to get it to increase to 2. When it's 2, it's (200/198). All the way up to when my stat reaches 199, and it will take (200/199) messages to get it to hit 200.
So, for one stat, the average number of messages to max it are:
(200/199) + (200/198) + ... + (200/2) + (200/1)Which can also be written as:
The sum from i=1 to 199 of (200/i)And this is easily changed for a start of 200 and a goal of 455 (I wrote 405, I meant 455, my bad):
The sum from i=1 to 454 of (455/i)In the end I just plugged these into wolframalpha, I'm sure there's a formula for the sums but I'm too tired to remember that or my answers. Anyways, thanks for reading :) lmk if you have questions.