# Triangle Numbers. Simon’s own code

Now this was pretty amazing! Simon’s new own code, that he so nonchalantly wrote while “having a break” from practicing recursive functions, generates “triangular numbers”.

A triangular number or triangle number counts the objects that can form an equilateral triangle. The nth triangular number is equal to the sum of the n natural numbers from 1 to n. The sequence of triangular numbers is

1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 153, 171, 190, 210, 231, 253, 276, 300, 325, 351, 378, 406 …

“This particular piece of code works with any sequence”, Simon said: He tried to build the whole triangle but got stuck.

# Recursive Function: Sierpinski triangle

Simon followed Daniel Shiffman’s Fractal Recursion tutorial on how to write functions in Processing that call themselves (recursion) for the purpose of drawing fractals.

Later he programmed a Sierpinski triangle from memory, using circles. A Sierpinski triangle is a fractal set with the overall shape of an equilateral triangle, subdivided recursively into smaller equilateral triangles. Originally constructed as a curve, this is one of the basic examples of self-similar sets, i.e., it is a mathematically generated pattern that can be reproducible at any magnification or reduction. It is named after the Polish mathematician Wacław Sierpiński, but is actually a reincarnation of Pascal’s triangle.

# Some more vacation “art”

Pascal’s triangle (used as an aide in combinatorics) here drawn by Simon to help calculate dice and coin combinations The insides of the Earth and its atmosphere 