What is the logic behind this problem I am not getting it?problem: http://www.spoj.com/problems/CANTON/
I think the problem statement is concise enough, perhaps a picture like this might be useful https://en.wikipedia.org/wiki/Rational_number#/media/File:Diagonal_argument.svg
I have got the pattern visually but not being able to derive the formula. Is there any specific approach or just hit and trial is the way?