Floyd's Triangle
   HOME

TheInfoList



OR:

Floyd's triangle is a triangular array of
natural number In mathematics, the natural numbers are those numbers used for counting (as in "there are ''six'' coins on the table") and ordering (as in "this is the ''third'' largest city in the country"). Numbers used for counting are called ''cardinal ...
s used in
computer science Computer science is the study of computation, automation, and information. Computer science spans theoretical disciplines (such as algorithms, theory of computation, information theory, and automation) to practical disciplines (includi ...
education. It is named after Robert Floyd. It is defined by filling the rows of the triangle with consecutive numbers, starting with a 1 in the top left corner: The problem of writing a
computer program A computer program is a sequence or set of instructions in a programming language for a computer to execute. Computer programs are one component of software, which also includes documentation and other intangible components. A computer program ...
to produce this triangle has been frequently used as an exercise or example for beginning computer programmers, covering the concepts of text formatting and simple loop constructs.


Properties

*The numbers along the left edge of the triangle are the
lazy caterer's sequence The lazy caterer's sequence, more formally known as the central polygonal numbers, describes the maximum number of pieces of a disk (a pancake or pizza is usually used to describe the situation) that can be made with a given number of straight cu ...
and the numbers along the right edge are the
triangular number A triangular number or triangle number counts objects arranged in an equilateral triangle. Triangular numbers are a type of figurate number, other examples being square numbers and cube numbers. The th triangular number is the number of dots i ...
s. The ''n''th row sums to , the constant of an magic square . *Summing up the row sums in Floyd's triangle reveals the doubly triangular numbers, triangular numbers with an index that is triangular..
1            = 1 = T(T(1)) 1            = 6 = T(T(2)) 2 + 3 1 2 + 3     = 21 = T(T(3)) 4 + 5 + 6
*Each number in the triangle is smaller than the number below it by the index of its row.


See also

*
Pascal's triangle In mathematics, Pascal's triangle is a triangular array of the binomial coefficients that arises in probability theory, combinatorics, and algebra. In much of the Western world, it is named after the French mathematician Blaise Pascal, although o ...


References

{{reflist


External links


Floyd's triangle at Rosetta code
Triangles of numbers Computer programming Computer science education