0 out of 464 challenges solved
A triangular number is a number that can be represented as a triangle with dots. The nth triangular number is given by the formula:
\[ T_n = \frac{n(n+1)}{2} \]
Write a Python function `find_index(n)` that finds the index of the smallest triangular number with exactly `n` digits.
#### Example Usage
```python [main.nopy]
find_index(2) # Output: 4
find_index(3) # Output: 14
find_index(4) # Output: 45
```
#### Constraints
- The input `n` will be a positive integer.
- The function should return the smallest index `k` such that the triangular number \( T_k \) has exactly `n` digits.import math
def find_index(n):
"""
Find the index of the smallest triangular number with exactly n digits.
Args:
n (int): The number of digits.
Returns:
int: The index of the smallest triangular number with n digits.
"""
# Placeholder for the solution
pass