A triangular number correspond to the number of dots that would appear in an equilateral triangle when using a basic triangular pattern to build the triangule.
The triangular numbers sequence contains all the triangular numbers in order.
The first 10 numbers of the triangular number sequence are:
The following table shows how we can calculate each triangular number from this sequence:
So using an iterative approach in Python we can easily write a script to work out the first 100 triangular numbers:
This short program is a good example of:
Finding the nth term in the sequence
THe following mathematical formula can be used to find the nth triangular number in this sequence:
Other Number Sequences
The following Python challenges will get you to work with different types of number sequences and series:
- Finding the tirst 100 terms of different number sequences.
- Finding the nth term of a number sequence.
- The Collatz Conjecture.
Series vs. Sequence?
Did you know?
The main difference between a series and a sequence is that a series is the sum of the terms of a sequence.
So let’s investigate the following Python challenges based on series:
You may also enjoy the following challenge: