Sierpinski Triangle

Routine Summary

Displays the Sierpinski Triangle.





Variables Used

L₁, L₂, A, B, C

Calculator Compatibility




URL: United TI


:Repeat getKey

A Sierpinski triangle is a very common fractal that almost everybody has seen. It consists of a large triangle divided into three smaller triangles, which are then themselves divided into three smaller triangles, and this is repeated infinitely until the triangles are so small you can barely see them.

In order to construct a Sierpinski triangle on the calculator, you need to use the graph screen. Before we can use the graph screen, however, we need to perform some basic setup. We then create our variables: two lists (one for the X coordinates and one for the Y coordinates) and two numerics (one for a random X number and one for a random Y number).

Once we have our variables created, we start randomly coming up with places to display the pixels that will make up the triangle. Based on the formula used to generate the triangle, we take the average of the random list values and the random numbers that were generated, and use those for the coordinates of the next pixel. This gets repeated over and over again until either the triangle is completed or you press a key.


Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Noncommercial 2.5 License.