How can i generate the next rational number into 2 integer variables. For example, (1,1) (2,1) (1,2) (1,3) (3,1) .. I have the algorithm to generate it :
if(n % 2 == d % 2)
{
n++;
if(d > 1) d--;
}
else{
d++;
if(n > 1) n--;
}
The problem is how to build a dynamic stream inAgda
a. I will start from (1,1) and then generate the next pair and add it to stream.
Please anyone help.