I don't think that's right, but that's a 2 minute review of your question, not knowing the solution yet.... The thought that the file name can either be 1, 2, ..., 32 characters has me thinking its more like: 37!+36!+35!+...2!+1!

bhearn, that looks like the type of formula my son (college junior) is studying to prepare for the first actuarial exam next month! I asked, "Is it a closed-book test??" He double-checked and it is. I think I'll stick to engineering.