I am not a professional mathematician but a software developer given the generalization of this problem as a coding challenge. I implemented a simple site and open-sourced the code much to the help of this thread clarifying the equation so thought it would be a valuable addition. My algorithm code can be seen at https://github.com/metame/infinite-lake/blob/master/app/js/algorithm.js. You can also use the live tool at http://michaeljerwin.com/twobuckets.