I'm unable to get the third option (If j > k...) to match the results for the first two options. Copied from https://github.com/wallberg/sandbox/issues/1