Percentage problem for fair usage

71 Views Asked by At

I need some help for calculating fair usage percentage

I got $50000$ main credits to use daily and $30$ users in my website.

Each users bought different number of sub credits. For example user $1=100000$ sub credits, user $2= 50000$ sub credits, user $3=75000$ sub credits.

User with larger sub credits should get more quota usage compare to user with smaller sub credits. The percentage quota is based on their first day starting sub credits.

What formula can be use to calculate the percentage of each user fair usage for $50000$ main credits daily?

1

There are 1 best solutions below

0
On

Let's call $x_k^s$ the number of subcredits of any user $k$.

Here, $x_1^s = 100000, ~~x_2^s = 50000, ~~x_3^s = 75000$

First you have to determine the fraction of quota each user can get. Let $T^s$ be the total amount of subcredits, for a community of $N$ users $$ T^s = \sum_{i=1}^{N}x_i^s $$ Hence for each user $k$, The fraction they can get is $$ F_k = \frac{x_k^s}{T^s} $$ And if $T^m$ is the total amount of main credits, then we have the number of main credits $x_k^m$ any user $k$ can get : $$ \forall k \le N, x^m_k = T^m \times F_k = T^m \times \frac{x_k^s}{T^s} = \frac{T^m \times x_k^s}{\sum_{i=1}^{N}x_i^s } $$