If the numerator and the denominator are coprime
if ( __gcd ( i , j ) == 1 ) { string a = i . ToString ( ) ; string b = j . ToString ( ) ; Console . Write ( a + " / " + b + " , ▁ " ) ; } } } } static int __gcd ( int a , int b ) { return b == 0 ? a : __gcd ( b , a % b ) ; }