Thats a terrificly terrible math problem, if you've never tried it before (seeded tournaments). Having variable, or odd numbers of entrants only adds to complicate matters.
If you want this quickly, see if you can find something prewritten, or just make a static html page that shows the bracket/tree. Better yet, a big peice of paper and a sharpie is all you really need.