Sierpinski Triangle Algorithm

The Sierpiński triangle (sometimes spelled Sierpinski), also named the Sierpiński gasket or Sierpiński sieve, is a fractal attractive fixed set with the overall shape of an equilateral triangle, subdivided recursively into smaller equilateral triangles. It is named after the Polish mathematician Wacław Sierpiński, but looked as a decorative shape many centuries before the work of Sierpiński. However, like shapes look already in the 13th-century Cosmati Mosaics in the cathedral of Anagni, Italy, and other places of central Italy, for carpets in many places such as the nave of the Roman Basilica of Santa Maria in Cosmedin, and for isolated triangles placed in rotae in several churches and basilicas. The Apollonian gasket was first described by Apollonius of Perga (3rd century BC) and further analyzed by Gottfried Leibniz (17th century), and is a curved precursor of the 20th-century Sierpiński triangle. Wacław Sierpiński described the Sierpinski triangle in 1915.

Sierpinski Triangle source code, pseudocode and analysis