Green Sock Algorithm

A 4-1 Sock Pairing System

This algorithm is a simple, yet elegant solution to the age-old problem of finding the perfect sock pairing.

Or, if you're feeling particularly adventurous: