Solved problem 12

Re-wrote entire program.  Solves in 17 seconds.  Some more optimization
is possable with the tvalue varable.  Might revise later.