Английская Википедия:Floyd's triangle

Материал из Онлайн справочника
Перейти к навигацииПерейти к поиску

Шаблон:Short description Floyd's triangle is a triangular array of natural numbers used in computer science 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:

1
2 3
4 5 6
7 8 9 10
11 12 13 14 15

The problem of writing 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.[1][2][3][4]

Properties

Файл:Centered square numbers vs triangular numbers.svg
Centered square numbers, highlighted in red, are in found in the center of the odd rows, and are the sum of successive squares – taking 25 as an example, it is the sum of 16 (rotated yellow square) and the next smaller square, 9 (sum of blue triangles)

<poem>

1            = 1 = T(T(1))


1            = 6 = T(T(2)) 2 + 3

1 2 + 3     = 21 = T(T(3)) 4 + 5 + 6

</poem>

  • Each number in the triangle is smaller than the number below it by the index of its row.

See also

References

Шаблон:Reflist

External links