# How can I optimize this? Finding someone using several factors

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 Light Blue Shade F

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.
• 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). – Gerry Myerson Oct 18 '13 at 23:13