# 2007 AIME I Problems/Problem 11

## Problem

For each positive integer $p$, let $b(p)$ denote the unique positive integer $k$ such that $|k-\sqrt{p}| < \frac{1}{2}$. For example, $b(6) = 2$ and $b(23) = 5$. If $S = \sum_{p=1}^{2007} b(p),$ find the remainder when $S$ is divided by 1000.

## Solution $\left(k- \frac 12\right)^2=k^2-k+\frac 14$ and $\left(k+ \frac 12\right)^2=k^2+k+ \frac 14$. Therefore $b(p)=k$ if and only if $p$ is in this range, or $k^2-k. There are $2k$ numbers in this range, so the sum of $b(p)$ over this range is $(2k)k=2k^2$. $44<\sqrt{2007}<45$, so all numbers $1$ to $44$ have their full range. Summing this up with the formula for the sum of the first $n$ squares ( $\frac{n(n+1)(2n+1)}{6}$), we get $\sum_{k=1}^{44}2k^2=2\frac{44(44+1)(2*44+1)}{6}=58740$. We need only consider the $740$ because we are working with modulo $1000$.

Now consider the range of numbers such that $b(p)=45$. These numbers are $\left\lceil\frac{44^2 + 45^2}{2}\right\rceil = 1981$ to $2007$. There are $2007 - 1981 + 1 = 27$ (1 to be inclusive) of them. $27*45=1215$, and $215+740= \boxed{955}$, the answer.

The problems on this page are copyrighted by the Mathematical Association of America's American Mathematics Competitions. 