there, sir.
I'm a Developer and now working on a project. So the problem is...
A program generates a 6-digit number for a winning ticket with each digit between a range of (0-9). Then user buys some tickets and compares them to the winning number to win. I'm trying to calculate how much of the rewards will remain unclaimed if no one can match and win the lottery.
Each time a random sequence is generated, it's compared to the winning sequence. The sequence is broken down into an array of single numbers.
The winning sequence and random sequence are 6 digits sequences by default.
Let's stack them up side-by-side.
| index 0 | index 1 | index 2 | index 3 | index 4 | index 5 |
|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 |
| 1 | 2 | 3 | 9 | 8 | 6 |
The "tier" of the match is the cardinality less the first N matching numbers.
In the above example, the first three numbers match:
As it can be said, the match's tier is 6-3 or three if the prize money is 10000 dollars, then.
| Tier | Percentage | Number of winners | Prize per winner $ |
|---|---|---|---|
| 0 | 20% | 1 | 2000.0 |
| 1 | 10% | 3 | 333.3 |
| 2 | 14% | 9 | 155.6 |
| 3 | 12% | 27 | 44.4 |
| 4 | 19% | 81 | 23.5 |
| 5 | 25% | 243 | 10.2 |
Let's say 100,000 tickets are being bought until the end of the lottery. What is the total percentage of prizes that remained unclaimed?
NOTE:
- If the user is eligible for Tier 0 (higher tier), all of the digits match, so all the other Tiers become ineligible for the user. i.e., Tier 1,2, and so on.
- If all the prizes of the Tier are claimed, then the user might not win anything that works on a first-come-first, serve basis. It also means that 2 or more users can draw the same sequence, but only the first one will win
MY WORKING. PLEASE LET ME KNOW IF I'M DOING IT RIGHT OR WRONG.
I was using an example to present my work. Let's say the winning sequence is 1-2-3-4-5-6.
I am using cumulative binomial probabilities to get the % of total prizes to be claimed or unclaimed. I am using this calculator here.
Starting with Tier 5: Users have to draw 1 to win at least 10.2 worth of prizes. Probability of success on a single trial: 0.1 Number of attempts: 10,000 Number of successes (x): 243 (See table above)
So the cumulative binomial probabilities > 0.999999.
REAL ISSUE As I moved towards the Tier 4: Users have to draw Digit 1 AND 2 to win at least win Tier-4 worth of prizes. Probability of success on a single trial: 0.1 * 0.999999(FROM LAST cumulative binomial probability) Number of attempts: 1000 (Since only 1/10 will draw 1 as the first digit so, only Number of successes (x): 81 (See table above)
So the cumulative binomial probabilities > 0.98238842532.
Tier 3 Users have to draw Digit 1, 2, and 3 to win at least win Tier-3 worth of prizes. Probability of success on a single trial: 0.1 * 0.999999*0.98238842532(FROM LAST cumulative binomial probability) Number of attempts: 100 Number of successes (x): 27 (See table above)
So the cumulative binomial probabilities 0.00000122394.
AND SO ON. DOES THIS MAKES SENSE.