Is there a reference, that I can use, for predicting high/low tide from the water line height? I don't want to construct a solution based on the test suite data.
Yes, finally a notorious prime problem! It was so satisfying to see the large range test cases pass. As hinted by someone, the trick is to avoid unnecessary computation, be it computing the primes or checking for 5 in the digits. I recommend careful timing of each code segment.