### Inverted Difference Triangle

Introduction
Similar to Pascal’s triangle, the difference triangle has some interesting properties that find applications in various fields of the natural and applied sciences. In simple terms, a difference triangle is a set of integers arranged in an inverted triangle where each inverted triangle triad has its lower element equal to the difference (absolute value) of the two elements in the upper row.
A difference triangle can be created from a sequence of integers forming the uppermost row by iteratively taking differences between consecutive terms to form the next row until a single-element row is created.
Example
Consider the sequence 5, 8, 13, 21, 34, 55 from the Fibonacci series as the uppermost row of the difference triangle. The difference between successive elements form a new set: 3 (= 8 – 5), 5 (= 13 – 8), 8 (= 21 – 13), 13 (= 34 – 21), and 21 (= 55 – 34). The process can then be repeated until there is only one element left giving the following difference triangle:
5 8 13 21 34 55
3 5 8 13 21
2 3 5 8
1 2 3
1 1
0
Problem
Write a program that forms a difference triangle using a given series of numbers as topmost row.
Last edited on
What do you need help with?
Are you looking for someone to do it for you? If so, please move it to the jobs section and perhaps add a 5\$ reward :P
Alternatively you could learn some basic programming and do the code yourself, and post here if you have problems.
Topic archived. No new replies allowed.