21
4
The Koch snowflake (also known as the Koch star and Koch island) is a mathematical curve and one of the earliest fractal curves to have been described. It is based on the Koch curve, which appeared in a 1904 paper titled "On a continuous curve without tangents, constructible from elementary geometry" (original French title: "Sur une courbe continue sans tangente, obtenue par une construction géométrique élémentaire") by the Swedish mathematician Helge von Koch.
Here are some ascii representations of various iterations:
n=1
__
\/
n=2
__/\__
\ /
/_ _\
\/
n=3
__/\__
\ /
__/\__/ \__/\__
\ /
/_ _\
\ /
__/ \__
\ /
/_ __ __ _\
\/ \ / \/
/_ _\
\/
Since there is obviously a limit to the resolution of the ascii representation, we must enlarge the size of the snowflake by a factor of 3 for each iteration to show the extra detail.
Write the shortest code to output the snowflake in the same style for n=4
Your program should not take any input.
Your program should write the snowflake to the console.
Koch-snowflake ..a tag .. thats interesting..!!.. seems you will be firing more questions on this tag :) – Aman ZeeK Verma – 2011-02-17T19:22:39.430
5Too short for an answer: http://www.wolframalpha.com/input/?i=koch+snowflake+4 :D – Dr. belisarius – 2011-02-18T21:05:30.890
1Should the accepted answer be changed? There are shorter solutions now. – Timwi – 2011-04-02T11:36:13.080