finally got problem 27 part b working, had to rewrite it; it's still horrifically computationally inefficient; add tests for 27b