1

There is a game where you need to gather money from people participating to it and when you have the total you need to divide it in order to put a "reasonable amount" for each of the n prizes they will be able to win.

E.g. in general we usually make the calcution approximately, so in case you have a total of 8$ (t = 8) and 5 prizes (n = 5) we could divide the total into:

  • prize 1: 0.8$
  • prize 2: 1.2$
  • prize 3: 1.5$
  • prize 4: 1.9$
  • prize 5: 2.6$

As you can see it would be important to have prize n to be "more important" than prize 1, in general.

I would like to find a rule to obtain those prize values dynamically according to:

  • t = total amount of money
  • n = number of prizes
  • y = a variable factor to provide in order to abtain different combinations of prize values, in a way that a lower 'y' value means being more "fair" in giving values to prizes, on the contrary a higher 'y' value means increasing the difference between prize 1 and prize 'n'

E.g. in case I want to be more "fair" a possibility would be:

  • prize 1: 1.2$
  • prize 2: 1.4$
  • prize 3: 1.6$
  • prize 4: 1.8$
  • prize 5: 2.0$

or

  • prize 1: 1.1$
  • prize 2: 1.2$
  • prize 3: 1.5$
  • prize 4: 2.0$
  • prize 5: 2.2$

but I really have no idea about what formula or algorithm I could use to make that calculation by simply having as input (y, n and t) and how to be able to provide a y factor to use in order to vary the resulting prize values.

Any idea about it?

Thanks

Frank
  • 113

1 Answers1

4

Here's a possibility:

Set the $k$th prize to be $$ C r^{k-1} $$ for some value of $C$, where $r = 1 + y$. For $y = 0$, you get all prizes the same; for $y = 1$, each prize is double the previous one. For $y = 0.1$, you get something like the values you had.

Of course, to complete this, I have to give a value for $C$. But we know that the sum of all the prizes has to be $$ C(1 + r + \ldots + r^{n-1}) = C \frac{1-r^n}{1-r} $$ and we want this sum to be the total $t$. That means that $$ C = t \frac{1-r}{1-r^n}. $$ The formula for the $k$th prize, where $k$ goes from $1$ to $n$ is thus \begin{align} p_k &= t\, r^{k-1} \frac{1-r}{1-r^n}\\ &= t\, (1+y)^{k-1} \frac{y}{(1+y)^n - 1} \end{align}

If I were writing a program, I'd compute $r = 1+y$ first, and then use the first form rather than the second, but that's a matter of taste.

John Hughes
  • 93,729
  • thank you! I tried to compute it (in javascript): var prizes = 5; var factor = 0.2; var prizeValues = []; var money = 0; for (var k = 1; k <= prizes; k++) { var calc = (prizes * ((1 + factor) ^ (k - 1))) * (factor / (((1 + factor) ^ prizes) - 1)); prizeValues.push(calc); money += calc; } console.warn(prizeValues); console.warn(money);

    but the result is: [0.3333333333333333, 0, 1, 0.6666666666666666, 1.6666666666666667] and total money is 3.666666666666667. What if I want to avoid o as value for a k?

    – Frank Dec 31 '18 at 14:27
  • 1
    You seem to be assuming that the total of the prizes is the same as the number of prizes because you use $n$ for both. I don't think that is intended. It would be good to use a different variable for one of them. – Ross Millikan Dec 31 '18 at 14:35
  • @RossMillikan sorry I did not understand your point. What is my mistake? Thank you – Frank Dec 31 '18 at 14:41
  • In the first display equation you have $n$ terms in the sum on the left, which represents $n$ prizes. Then you say you want the total to be $n$. In the original post there were $5$ prizes totaling $8$, so one of the two uses of $n$ should be changed to a different variable. OP uses $t$ for the total of the prizes. This just scales the equation by $\frac tn$, not a big deal. – Ross Millikan Dec 31 '18 at 14:57
  • @RossMillikan thanks. So, in case I have 8 as total amount of money and 5 as total number of prizes how do I rewrite the formulate that @JohnHughes provided? – Frank Dec 31 '18 at 17:00
  • 1
    Yes, it becomes $C=t\frac {1-r}{1-r^n}$ with $n=5,t=8$ – Ross Millikan Dec 31 '18 at 17:03
  • @RossMillikan Ok I edited my code above and I have var calc = (totalMoney * ((1 + factor) ^ (k - 1))) * (factor / (((1 + factor) ^ prizes) - 1)); with var totalMoney = 8;. Still, when I run it I get [ 0.5333333333333333, 0, 1.6, 1.0666666666666667, 2.6666666666666665 ] and 5.866666666666667 so I have a 0 that I would not want and the total money is 5.866666666666667 but I expected it to be 8 at the end no? What am I doing wrong? – Frank Dec 31 '18 at 17:11
  • I've edited to make the sum of prizes be $t$ instead of $n$. Sorry for going on vacation and leaving a mess for you to clean up, @RossMillikan. – John Hughes Jan 01 '19 at 20:30
  • @Frank how did you fix the code? – LumbusterTick Sep 09 '20 at 12:37
  • ok I fixed it, @JohnHughes amazing man thanks thumbs up and upvoted – LumbusterTick Sep 10 '20 at 12:07