Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to assemble a calculation that takes a known number of items (30) and places them into a set number of containers (3) and to calculate that items 1-10 go into container 1, 11-20 go into container 2 and 21-30 go into container 3... over time the number of items will grow infinitely and the number of containers will equal #items/10 (rounded up to the next whole number, so that 35 items would have 4 containers)... Known = # items Known = # containers Items must go into specific containers (items 1-10 must go into container 1, 11-20 into contain 2 and so on)

share|cite|improve this question

This is bucket sort.

share|cite|improve this answer

If you have $I$ items and $C$ containers, the number per container is $N=\lceil \frac{I}{C} \rceil$ Then the bin number for item $m$ is $\lfloor \frac{m-1}{N}\rfloor +1$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.