Odd Triangle Sum

Odd numbers can be arranged as a triangle: one number in the first row, two in the second, three in the third, and so on. Write a function row_sum_odd_numbers that takes a row number n and returns the sum of the numbers in that row. Row numbering starts from 1.

Примеры

Ввод
1
Вывод
1
Ввод
2
Вывод
8
Ввод
13
Вывод
2197

Нужно реализовать

def row_sum_odd_numbers(n: int) -> int:

Теги

math
PostgreSQLv16

Tu sa zobrazí výsledok spustenia kódu

Visible tests
1
Input
1
Expected1
2
Input
2
Expected8
3
Input
13
Expected2197
4
Input
19
Expected6859
5
Input
41
Expected68921
6
Input
0
Expected0
Focus radio
Paused · SomaFM · Fluid