$n$ symbols line up in a row, numbered as $1,2,...,n$ from left to right. Delete every symbol with squared numbers. Renumber the rest from left to right. Repeat the process until all $n$ symbols are deleted. Let $f(n)$ be the initial number of the last symbol deleted. Find $f(n)$ in terms of $n$ and find $f(2019)$.
1. **Define the necessary terms:**
   - Let \( a_n \) be the greatest integer such that \( a_n^2 \leq n \).
   - Let \( b_n = n - a_n^2 \).

2. **Define the function \( f(n) \):**
   \[
   f(n) = \begin{cases}
   a_n^2 + 1 & \text{if } b_n \leq a_n \\
   a_n^2 + a_n + 1 & \text{if } a_n < b_n \leq 2a_n + 1
   \end{cases}
   \]

3. **Base case:**
   - For \( n = 1 \), \( a_1 = 1 \) and \( b_1 = 0 \). Thus, \( f(1) = 1^2 + 1 = 2 \).

4. **Inductive step:**
   - Assume the formula holds for all \( k < n \).
   - If \( n \) is a perfect square, then \( n = a_n^2 \) and \( b_n = 0 \). Thus, \( f(n) = f(n-1) \).
   - If \( n \) is not a perfect square, consider two cases:
     - **Case 1:** \( b_n \leq a_n \)
       - There are \( a_n \) terms removed.
       - Renumber the remaining terms as \( x_1, x_2, \ldots, x_{n-a_n} \).
       - By hypothesis, \( f(n-a_n) = a_{n-a_n}^2 + a_{n-a_n} + 1 \).
       - Since \( a_{n-a_n} = a_n - 1 \), we have \( f(n-a_n) = (a_n - 1)^2 + (a_n - 1) + 1 \).
       - Simplifying, \( f(n-a_n) = a_n^2 - 2a_n + 1 + a_n - 1 + 1 = a_n^2 - a_n + 1 \).
       - Therefore, \( f(n) = f(n-a_n) + a_n = a_n^2 - a_n + 1 + a_n = a_n^2 + 1 \).
     - **Case 2:** \( a_n < b_n \leq 2a_n + 1 \)
       - Similarly, \( f(n-a_n) = a_n^2 + 1 \).
       - Therefore, \( f(n) = f(n-a_n) + a_n = a_n^2 + 1 + a_n = a_n^2 + a_n + 1 \).

5. **Calculate \( f(2019) \):**
   - \( a_{2019} = \lfloor \sqrt{2019} \rfloor = 44 \).
   - \( b_{2019} = 2019 - 44^2 = 2019 - 1936 = 83 \).
   - Since \( 83 > 44 \), we use the second case:
     \[
     f(2019) = 44^2 + 44 + 1 = 1936 + 44 + 1 = 1981.
     \]

The final answer is \(\boxed{1981}\).