Geometric Sum

A geometric progression is a sequence where each next term is made by multiplying the previous one by the same number. Given the first term first_term, the common ratio common_ratio, and the number of terms num_of_terms, calculate the sum of the first num_of_terms terms. Return the resulting number.

Примеры

Ввод
1, 2, 10
Вывод
1023
Ввод
1, 10, 5
Вывод
11111
Ввод
0, 2, 10
Вывод
0

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

def sum_of_geometric_progression(
    first_term: int, common_ratio: int, num_of_terms: int
) -> float:

Теги

math
PostgreSQLv16

Qui apparirà il risultato dell'esecuzione del codice

Visible tests
1
Input
1, 2, 10
Expected1023
2
Input
1, 10, 5
Expected11111
3
Input
0, 2, 10
Expected0
4
Input
1, 0, 10
Expected1
5
Input
1, 2, 0
Expected0
6
Input
-1, 2, 10
Expected-1023
Focus radio
Paused · SomaFM · Fluid