The sum of integers from $1$ to $p-1$ is equal to the sum of integers from $p+1$ to $49$. Find the value of $p$
I'm not sure if the value of $d$ and $n$ are the same where:
$n =$ the number of terms
$a =$ the first term.
I've spent a few hours trying to answer this question but can't work it out. Please help
The set $\left\{1,2,\ldots,p-1\right\}$ has $p-1$ terms, the first is $1$ and the last is $p-1$, so $$1+2+\ldots+(p-1)=\frac{(p-1)p}{2}$$ The other set has $49-p$ terms, then $$(p+1)+(p+2)+\ldots+49=\frac{(49-p)(p+1+49)}{2}=\frac{(49-p)(p+50)}2$$ So, we have $$\frac{(p-1)p}2=\frac{(49-p)(p+50)}2\quad\iff\quad p^2-p=2450-p-p^2\quad\iff \quad2p^2=2450$$ Then $$p^2=1225\quad\implies\quad \boxed{\color{red}{p=35}}$$