This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Title | |
*/ | |
import java.io.BufferedOutputStream; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
public class Main { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 264 - Count on Cantor | |
* | |
* Given an input value N, print the Nth term in Cantor's enumeration. | |
* | |
* There may be a simpler closed form of this. However, what strikes me as | |
* possible right now is: we figure out what diagonal n is on, which gives us | |
* the beginning of that diagonal (1/2, 3/1, 1/4, 5/1, etc.). Then, we adjust | |
* the numerator and denominator based on the distance from the first term in | |
* the diagonal and the direction it takes (up-right for odd, down-left for |
NewerOlder