0 out of 464 challenges solved
A decagonal number is a figurate number that represents a decagon. The formula to calculate the nth decagonal number is given by: \[ D_n = 4n^2 - 3n \] Write a Python function `nth_decagonal_number(n)` that takes an integer `n` as input and returns the nth decagonal number. #### Example Usage ```python [main.nopy] print(nth_decagonal_number(1)) # Output: 1 print(nth_decagonal_number(3)) # Output: 27 print(nth_decagonal_number(7)) # Output: 175 ``` #### Constraints - The input `n` will be a positive integer. - The function should return an integer.
def nth_decagonal_number(n): """ Calculate the nth decagonal number. Args: n (int): The position of the decagonal number to calculate. Returns: int: The nth decagonal number. """ # Implement the formula for the nth decagonal number pass