# 2007 iTest Problems/Problem 40

## Problem

Let $S$ be the sum of all $x$ such that $1\leq x\leq 99$ and $\{x^2\}=\{x\}^2$. Compute $\lfloor S\rfloor$.

## Solution

Rewrite $x$ as $\lfloor x \rfloor + \{ x \}$. That results in $$\{ 2 \lfloor x \rfloor \{ x \} + \{ x \}^2 \} = \{ x \}^2$$ Note that if $2 \lfloor x \rfloor \{ x \}$ is not an integer, than both sides can not equal each other. Thus, to find all solutions where $1 \le x \le 99$, find the values where $2 \lfloor x \rfloor \{ x \}$ is an integer.

• The easier case is when $x$ is an integer. If $x$ is an integer, then $\{ x \} = 0$, so both sides equal each other. Therefore, every integer from $1$ to $99$ is a solution.
• The harder case is when $x$ is not an integer. Let $x = n \frac{a}{b}$, where $n$ is an integer from $1$ to $98$, and $a$ and $b$ are relatively prime integers, where $0 < a < b$. That means $2 \lfloor x \rfloor \{ x \} = 2n \cdot \frac{a}{b}$. Since $a$ and $b$ are relatively prime, $b$ must be a factor of $2n$. That means every mixed number in the form $n \frac{c}{2n}$, where $0 < c < 2n$ works.

With that taken in consideration, the sum $S$ equals $$(1 + 1\frac{1}{2}) + (2 + 2\frac{1}{4} \cdots) \cdots (98 + 98\frac{1}{196} \cdots) + 99$$ The arithmetic series sum formula can be used to simplify things further. If the first term is $n$, common difference is $\frac{1}{2n}$, and last term is $n - \frac{1}{2n}$, the sum of the terms in the series is $\frac{2n(2n+1 - \frac{1}{2n})}{2} = 2n^2 + n - \frac{1}{2}$. Now $S$ equals $$\sum_{n=1}^{98} (2n^2 + n - \frac{1}{2} ) + 99$$ $$2 \sum_{n=1}^{98} (n^2) + \sum_{n=1}^{98} (n) - 98 \cdot \frac{1}{2} + 99$$ $$2 \cdot \frac{98 \cdot 99 \cdot 197}{6} + \frac{99 \cdot 98}{2} - 49 + 99$$ $$49 \cdot 33 \cdot 397 + 50$$ $$641999$$ Thus, $\lfloor S \rfloor = \boxed{641999}$.