I have 100 students, and they all need colored pencils.

Each of them needs the same colors of pencils, however, they can have different shades of the color.

What's the least amount of color and shade combinations I need to purchase so that each student has a unique combination of shades?

So for example, if I decide 10 colors and 10 shades, Student 42 will have (I assigned the shades randomly)

  • Color Green Shade A
  • Color Red Shade J
  • Color Blue Shade C
  • Color Orange Shade A
  • Color Yellow Shade E
  • Color Indigo Shade B
  • Color Purple Shade D
  • Color Violet Shade A
  • Color Light Blue Shade F
  • Color Magenta Shade G

And I can be 100 percent sure that if given those color / shade combos, I will be able to tell you it's student 42.

But how can I optimize this so I need less color and shade combos (what's the least I need)? And once I have that smallest amount, how do I go about distributing it so it still has a 100% chance of finding the student?


Find some numbers $s_1,s_2,\dots,s_r$ that multiply to at least 100; then you can get by with $r$ colors, $s-1$ shades of the first color, $s_2$ shades of the second color, and so on, to $s_r$ shades of the last color.

For example, $5\times5\times4=100$, so it works to have 5 shades of red, 5 shades of blue, and 4 shades of green.

I suppose you could use 2 shades of orange, and 50 shades of gray (if you count gray as a color).

  • $\begingroup$ Thank you, this makes sense. Do you have an idea for how I would decide what shade to give each student, so they they would all be uniquely identifiable? $\endgroup$ – Ayub Oct 18 '13 at 23:06
  • $\begingroup$ Let's take the 5, 5, 4 example. Number the students from 0 to 99. Write the student number as $20r+4b+g$ with $0\le r\le4$, $0\le b\le4$, $0\le g\le3$ (example: $76=20\times3+4\times4+0$), and give the student red shade $r+1$, blue shade $b+1$, and green shade $g+1$ (in the example, red4, blue5, and green1). $\endgroup$ – Gerry Myerson Oct 18 '13 at 23:13
  • $\begingroup$ So, is this OK? $\endgroup$ – Gerry Myerson Oct 20 '13 at 0:29
  • $\begingroup$ Thank you very much for that! I've put the contents of your answer into code, but now to finish my project I need to code your formula. In my project, the amount of colors and the amount of students are going to be variable. Can you tell me how I can come to a formula like you did, given the amount of students and the amount of colors (e.g. how did you come up with 20r, 4b, etc.)? $\endgroup$ – Ayub Oct 23 '13 at 3:53
  • $\begingroup$ If, instead of 5, 5, 4, it had been a, b, c, then instead of 20, 4, 1 it would have been bc, c, 1. $\endgroup$ – Gerry Myerson Oct 23 '13 at 4:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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