http://www.douglaswagoner.com/email_frm.php I took your values test. Doing the part which sorts the values was a bit tedious. Being a geek, I thought about it, and realized that if you used a "quicksort" rather than a "bubblesort" (or equivalent), you could reduce the number of combinations required to be evaluated. In fact, if you wanted to get really fancy, you could use popular sorted values as the starting point and determining the pivot for the quicksort. That could drastically reduce the number of combinations required.