##Pyth, 30
Pyth, 30
jb_u+G+*leGd*HNu+N+^3hTNUQ]1]k
This is a program that takes input from STDIN and uses grc's method of finding the Cantor set. Uses the " character to display the curve.
Explanation:
I will explain the code in two parts, first, the cantor set generation:
u+N+^3hTNUQ]1
u UQ]1 : reduce( ... , over range(input), starting with [1])
+N : lambda N,T: N + ...
+^3hTN : 3 ** (T+1) + N (int + list in pyth is interpreted as [int] + list)
And the output formatting:
jb_u+G+*leGd*HN ]k
jb_ : "\n".join(reversed(...)
u ]k : reduce(lambda G,H: ... , over cantor set, starting with [""])
+G+*leGd : G + len(G[-1]) * " " + ...
*HN : H * '"'
Note that in pyth N = '"' by default.