See the following triangle:
```
____________________________________
 1                                      
 2   4   2                              
 3   6   9   6   3                      
 4   8   12  16  12  8   4             
 5   10  15  20  25  20  15  10  5   
 ___________________________________
 
```
The total sum of the numbers in the triangle, up to the 5th line included, is ```225```, part of it, ```144```, corresponds to the total sum of the even terms and ```81``` to the total sum of the odd terms.

Create a function that may output an array with three results for each value of n.
```python
triang_mult(n)  ----> [total_sum, total_even_sum, total_odd_sum]
```
Our example will be:
```python
triang_mult(5) ----> [225, 144, 81]
```

Features of the random tests:
```
number of tests = 100
49 < n < 5000
```
Enjoy it!
This kata will be translated in another languages soon

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Data structures

Mathematics

Starter code: def mult_triangle(n):
	

Solutions:
def mult_triangle(n):
	total = (n * (n + 1) / 2) ** 2
	odds = ((n + 1) // 2) ** 4
	return [total, total - odds, odds]


def mult_triangle(n):
	k = n * (n + 1) // 2
	p = ((n + 1) // 2) ** 4
	return [k * k, k * k - p, p]


def get_totals_for_row(n):
	total = n ** 3
	if n % 2 == 0:
		return [total, total, 0]
	else:
		even_total = n * (n ** 2 // 2)
		odd_total = total - even_total
		return [total, even_total, odd_total]

def mult_triangle(n):
	total = 0
	even_total = 0
	odd_total = 0
	for level in range(1, n + 1):
		(t, e, o) = get_totals_for_row(level)
		total += t
		even_total += e
		odd_total += o
	return [total, even_total, odd_total]


from math import ceil

def mult_triangle(n):
	s = (n * (n + 1) / 2) ** 2
	odd = ceil(n / 2) ** 4
	return [s, s - odd, odd]


def mult_triangle(n):
	total = (n * (n + 1) // 2) ** 2
	odd = ((n + 1) // 2) ** 4
	return [total, total - odd, odd]


def mult_triangle(n):
	(even, sum, i) = (0, 0, 1)
	while i <= n:
		sum += i * i * i
		even += i * (i - 1) * (i + 1) / 2 if i % 2 else i * i * i
		i += 1
	return [sum, even, sum - even]


def mult_triangle(n):
	n2 = n - 1 | 1
	total_sum = ((n + 1) * n // 2) ** 2
	total_odd_sum = ((n2 + 1) * (n2 + 1) // 4) ** 2
	return [total_sum, total_sum - total_odd_sum, total_odd_sum]


def mult_triangle(n):
	s = n * (n + 1) // 2
	s *= s
	d = (n + 1) // 2
	d *= d
	return [s, s - d * d, d * d]


def mult_triangle(n):
	(c, o) = (0, 0)
	for i in range(1, n + 1):
		v = i ** 2
		c += i * v
		if i & 1:
			o += i * (v + 1 >> 1)
	return [c, c - o, o]