A book is published in three volumes, with the pages numbered consecutively starting from $1$. The numbering continues from the first volume to the second and then to the third. The second volume contains $50$ more pages than the first volume, and the third volume contains one and a half times as many pages as the second volume. The sum of the page numbers on the first pages of the three volumes is $1709$. If $n$ is the last page number, what is the largest prime factor of $n$?

Let's think step by step and output the final answer within \boxed{}.
user