Coding, Geometry Joys, Java, Milestones, Murderous Maths, Simon's Own Code

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:

Triangle Numbers (This particular piece of code works with any sequence) 15 Apr 2017

He tried to build the whole triangle but got stuck.

Coding, Geometry Joys, Java, Murderous Maths

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.