Updated the cycle detection to make sure that j = i * 2