## Consecutive N

The sum of $N$ consecutive positive integers is 1998. If $N$ is odd, what is the greatest possible value for $N$?
Source: mathcontest.olemiss.edu 9/26/2011

SOLUTION
Before tackling this problem we should revisit two formulas related to the sum of consecutive positive integers. Let $a_1,a_2,a_3,\cdots,a_N$ where $N$ is odd be a collection of consecutive positive integers.
For example, $6,7, 8,9,10$ is such a collection where $N=5;a_1=6,a_2=7,\cdots,a_5=10$

Sum formula
The formula that calculates the sum is given by
$Sum=\frac{\left (a_N+a_1\right )\left (a_N-a_1+1\right )}{2}$
The second factor in the above formula $\left (a_N-a_1+1\right )$ really is the number of terms $N$ in the collection, so in this problem we have a simpler formula
$Sum=\frac{\left (a_N+a_1\right )N}{2}$
The sum in our example
$6+7+8+\cdots+10=\frac{\left (10+6\right )5}{2}=40$

Sum of first and last term
$a_1=a_1$
$a_2=a_1+1$
$a_3=a_2+1=\left (a_1+1\right )+1=a_1+2$
$a_4=a_3+1=\left (a_1+2\right )+1=a_1+3$
$\cdots$
$a_N=a_{N-1}+1=\left (a_1+N-2\right )+1=a_1+\left (N-1\right )$
Thus,
$a_1+a_N=a_1+a_1+\left (N-1\right )$
$a_1+a_N=2a_1+\left (N-1\right )$        (1)
In our example,
$6+10=2\times 6+\left (5-1\right )=12+4=16$

Guess and check method
Applying the sum formula yields
$\frac{\left (a_N+a_1\right )}{2}\times N=1998$
Decomposing 1998 into prime factors gives
$1998=2\cdot 3^3\cdot 37$

Case 1: $N=3^3\cdot 37=999$
$\frac{\left (a_N+a_1\right )}{2}\times 999=1998$
$\frac{\left (a_N+a_1\right )}{2}=\frac{1998}{999}=2$
$a_N+a_1=4$
Applying Eq. (1)
$a_1+a_N=2a_1+\left (N-1\right )$
$4=2a_1+\left (999-1\right )$
$4=2a_1+998$
$4-998=2a_1$
$-994=2a_1$
$-497=a_1$
not a solution because negative integers are not allowed.

Case 2: $N=3^2\cdot 37=333$
$\frac{\left (a_N+a_1\right )}{2}\times 333=1998$
$\frac{\left (a_N+a_1\right )}{2}=\frac{1998}{333}=6$
$a_N+a_1=12$
Applying Eq. (1)
$a_1+a_N=2a_1+\left (N-1\right )$
$12=2a_1+\left (333-1\right )$
$12=2a_1+332$
$12-332=2a_1$
$-320=2a_1$
$-160=a_1$
not a solution

Case 3: $N=3\cdot 37=111$
$\frac{\left (a_N+a_1\right )}{2}\times 111=1998$
$\frac{\left (a_N+a_1\right )}{2}=\frac{1998}{111}=18$
$a_N+a_1=36$
Applying Eq. (1)
$a_1+a_N=2a_1+\left (N-1\right )$
$36=2a_1+\left (111-1\right )$
$36=2a_1+110$
$36-110=2a_1$
$-74=2a_1$
$-37=a_1$
not a solution

Case 4: $N=37$
$\frac{\left (a_N+a_1\right )}{2}\times 37=1998$
$\frac{\left (a_N+a_1\right )}{2}=\frac{1998}{37}=54$
$a_N+a_1=108$
Applying Eq. (1)
$a_1+a_N=2a_1+\left (N-1\right )$
$108=2a_1+\left (37-1\right )$
$108=2a_1+36$
$108-36=2a_1$
$72=2a_1$
$36=a_1$
a solution!

Check
$N=37;a_1=36;a_{37}=72$
$36+37+\cdots +72=\frac{\left (72+36\right )37}{2}$
$=\frac{\left (108\right )37}{2}$
$=\left (54\right )37$
$=1998$

Answer: $N=37$.