Hi, I have written this c program https://ideone.com/5Mx4Rm And I have tested it with 10000 cases that I created using sequences up to 8 digits from a brute force solution. I have also tried a few large cases up to 12000 digits. I have tried all the test cases in SPOJToolkit. But my program still give me wrong answer. An clues would be appreciate or a test case I have missed. I have tried stripping leading zeros from output, but that did not work as well.