1. 

package problemSetVolumes.volume008;

import java.util.Scanner;

/**
* FWP, Ausgewählte Probleme aus dem ACM Programming Contest, SS10
* Problem: 880 - Cantor Fractions
* Link: http://uva.onlinejudge.org/index.php?option=onlinejudge&Itemid=99999999&page=show_problem&category=10&problem=821&mosmsg=Submission+received+with+ID+8351360
*
* @author Siegfried Ippisch
* @version 1.0
*
* Method : -
* Status : Accepted
* Runtime: 1.924
*/
public class CantorFractions {

public static void main(String[] args){
Scanner in = new Scanner(System.in);

while(in.hasNext()){
long i = in.nextLong();
long n = (int) Math.ceil(((Math.sqrt(1+8*i)-1)/2));
long ii = n*(n+1)/2;
long num = ii-i+1;
long den = n-num+1;
System.out.println(num+"/"+den);
}

in.close();
}
}

2.

/*
* ACM Contest training
* Problem: 880 - Cantor Fractions
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=10&problem=821
*
* @author Christoph Goettschkes
* @version 1.0, 10/27/2010
*
* Method : Ad-Hoc
* Status : Accepted
* Runtime: 1.264
*/

import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main
{
public static void main(String[] args) throws Exception {

BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

long n = Long.parseLong(reader.readLine().trim());

while(true)
{
long colN = (long)Math.ceil((-1 + Math.sqrt(1+(8*n))) / 2);
long max = (colN*colN+colN)/2;
long den = colN - (max - n);
long num = 1 + (max - n);

System.out.println(num + "/" + den);

if (!reader.ready())
break;
n = Long.parseLong(reader.readLine().trim());
}
}

}