Wow man with one sentence "Let's see... if I use the 5, then I have to form a sum of 16 with the remaining numbers. But if I don't use the 5, then... (is anything starting to click?)" you just solved the problem for me.
I will try to write it in perl and post it here.
Can you please explaine how you thought about this solution ?
Thanks.