Let {$x_k$}$^n_{k=1}$ be a sequence whose terms come from {$2,3,6$}. If $$x_1+x_2+...+x_n=633\quad and\quad \frac{1}{x^2_1}+\frac{1}{x^2_2}+...\frac{1}{x^2_n}=\frac{2017}{36}$$ find the value of $n$.
In an attempt to solve this problem I add the two equations, which gets
$$x_1+\frac{1}{x^2_1}+x_2+\frac{1}{x^2_2}+...+x_n+\frac{1}{x^2_n}=633+\frac{2017}{36}$$ $$=\frac{x^3_1+1}{x^2_1}+\frac{x^3_2+1}{x^2_2}+...\frac{x^3_n+1}{x^2_n}=\frac{24805}{36}$$
Based on the sequence any term $\frac{x^3_k+1}{x^2_k}$ should be equal to $\frac{81}{36},\frac{112}{36},$ or $\frac{217}{36}$.
So, the problem becomes finding out what combination of $81, 112,$ and $217$ adds ups to $24805$.
Though, how do you find such a combination? Is there another direction that I could go about solving this problem?
Let $u$ the number of $2$s, $v$ the number of $3$s and $w$ the number of $6$s among the numbers $x_1,\ldots x_n.$ Then we look for a non-negative integer solution of $$ \begin{pmatrix} 2 & 3 & 6 \\ \frac{1}{4} & \frac{1}{9} & \frac{1}{36} \end{pmatrix} \begin{pmatrix} u \\ v \\ w \end{pmatrix} = \begin{pmatrix} 633 \\ \frac{2017}{36} \end{pmatrix} $$ or $$ \begin{pmatrix} 2 & 3 & 6 \\ 9 & 4 & 1 \end{pmatrix} \begin{pmatrix} u \\ v \\ w \end{pmatrix} = \begin{pmatrix} 633 \\ 2017 \end{pmatrix} $$ Now we need the space of solutions of the homogeneous system $$ \begin{pmatrix} 2 & 3 & 6 \\ 9 & 4 & 1 \end{pmatrix} \begin{pmatrix} u \\ v \\ w \end{pmatrix} = 0 $$ which is easy, we can take the cross product of $(2\;\; 3\;\; 6)$ and $(9\;\; 4\;\; 1)$, which is $(-21\;\; 52\;\; -19)$ and use it as the basis of the solution space.
In order to find an integer solution of the original inhomogeneous system of equations in a more or less systematic way, we keep the row with the "1" in the matrix and eliminate the corresponding element, i.e. the "6", in the other row. This means, we subtract the first row from $6\times$ the second row: $$ \begin{pmatrix} 52 & 21 & 0 \\ 9 & 4 & 1 \end{pmatrix} \begin{pmatrix} u \\ v \\ w \end{pmatrix} = \begin{pmatrix} 11469 \\ 2017 \end{pmatrix} $$ Using the extended Euclidean algorithm, we find $(-2)\cdot 52+5\cdot 21 = 1.$ Therefore $(-2\cdot 11469)\cdot 52 + (5\cdot 11469)\cdot 21 = 11469.$ So we can set $u^{\ast}=-2\cdot 11469=-22938$ and $v^{\ast}=5\cdot 11469=57345$ and use the second equation $(9u+4v+w=2017)$ to get $w^{\ast} = 2017-9u^{\ast}-4v^{\ast} =-20921.$
Putting everything together, we get the general solution for the original system of equations: $$ \begin{pmatrix} u \\ v \\ w \end{pmatrix} = \begin{pmatrix} -22938 \\ \;\;57345 \\ -20921 \end{pmatrix} +c \begin{pmatrix} -21 \\ \;\;52 \\ -19 \end{pmatrix} $$ Now we have to find a number $c$ such that the solution is non-negative and integer. As the components of the vector $(-21 \;\; 52 \;\; -19)$ are coprime, $c$ must be an integer to make the solution consist of integers. It turns out that $c=-1102$ is the only possibility to get positive numbers $u,$ $v$ and $w$ $$ \begin{pmatrix} u \\ v \\ w \end{pmatrix} = \begin{pmatrix} -22938 \\ \;\;57345 \\ -20921 \end{pmatrix} -1102\cdot \begin{pmatrix} -21 \\ \;\;52 \\ -19 \end{pmatrix} = \begin{pmatrix} 204 \\ 41 \\ 17 \end{pmatrix} $$ So we have $n=204+41+17=262.$ Out of the numbers $x_1,\ldots ,x_{262},$ $204$ are $2,$ $41$ are $3$ and $17$ are $6$.