Balls & Bins has N Numbers with Capacity of 1000 each I am new to this Community. Actually I am myself a Software Engineer and our company has stuck to a problem and has not come up with a solution for many days. So, I just remembered an old school Math Chapter of Probability and a King to pass 8 doors etc. I thought Mathematicians can solve this problem. 

So, here is the problem, we have an increasing numbers of Email Addresses and Buckets. And each Bucket can hold 1000 Emails



Just for a side note, if it is hard to work on alphabats, we can convert each email to numbers first like a=1, b=2, c=3 ... z=26 with 0 (Zero) appended for making it unique and +s for @ and . characters. For Example

 abcd@gmail.com  -&gt;  10203040+901301090+3015013


So, now we have numbers which make it easier to apply any calculations. Once we get the solution, we will make a Hashing Library to solve problems in Software Industry
Each email can be given a unique primary key. This can be given relative to their positions when you sort them alphabetically, or convert strings to numbers or whatever way.

Now we essentially need to find which bucket holds that key.

If each bucket can hold $1000$ keys,
then key $1-1000$ are in first bucket, keys $1001-2000$ are in second bucket and so on.

Then given a key $K$ it lies in the $\lceil \frac{K}{1000}\rceil$ bucket.

Similarly if each bucket can hold $n$ emails, then you can replace $1000$ with $n$.
Each email can be given a unique primary key. This can be given relative to their positions when you sort them alphabetically, or convert strings to numbers or whatever way.

Now we essentially need to find which bucket holds that key.

If each bucket can hold $1000$ keys,
then key $1-1000$ are in first bucket, keys $1001-2000$ are in second bucket and so on.

Then given a key $K$ it lies in the $\lceil \frac{K}{1000}\rceil$ bucket.

Similarly if each bucket can hold $n$ emails, then you can replace $1000$ with $n$.