Let's say you have a triangle like:(adsbygoogle = window.adsbygoogle || []).push({});

1

2 3

4 5 6

7 8 9 10

The children of each element in the triangle are those directly adjacent on the next row. For example the children of 4 are 7 and 8. The children of 5 are 8 and 9.

Now let's say we flatten it to: [1,2,3,4,5,6,7,8,9,10]

Is there a way to compose a function that takes the index of the parent and returns a tuple containing the indexes of the children? (Assume 0 based indexes. The 1 through 10 are values, not indexes)

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Triangle calculation

**Physics Forums | Science Articles, Homework Help, Discussion**