<p><span style="font-size:22px"><a href="https://www.prepswift.com/quizzes/quiz/prepswift-sum-of-integers-in-interval" target="_blank">Sum of Integers in Interval Exercise</a></span></p>
<p><a href="https://drive.google.com/file/d/1wBb5lufQ928vc3pyRYxPdJ2FVEZamVrU/view?usp=sharing"><span style="font-size:16px;">Some clarifications</span></a></p>
<!--<p><iframe height="500" src="https://docs.google.com/document/d/e/2PACX-1vRe1x4kylVpsxmPf63VPDp08W31-7d5ZMtk2QzIYw-LewPWJeUXEgufVGW_OtjkG7EbNa_J9huLKrim/pub?embedded=true" width="600"></iframe></p>
--><!--<p><iframe height="480" src="https://drive.google.com/file/d/1wBb5lufQ928vc3pyRYxPdJ2FVEZamVrU/preview" width="640"></iframe></p>--><p>You can approach this problem in a several ways:</p>
<p><span style="color:#27ae60;"><span style="font-size:18px;">Sum of integers from $1$ to $n$</span></span></p>
<p>Whenever the interval starts with $1$, it's pretty simple. You just need to use the formula below. For example, to find the sum of the integers from $1$ to $80$, inclusive...</p>
<p>$$\frac{n(n+1)}{2}=\frac{80 \times 81}{2}=3240$$</p>
<p><span style="color:#27ae60;"><span style="font-size:18px;">Sum of integers from $n$ to $m$, where $n \neq 1$</span></span></p>
<p>For this one, you can follow these steps. For example, what is the sum of all integers from $30$ to $101$:</p>
<ol>
<li>Find the number of intergers in the interval: $101 - 30 +1 = 72$</li>
<li>Calculate the sum of the first and last number: $30+101=131$.</li>
<li>Multiply the numbers from steps 1 and 2 together and divide by $2$ (see below):</li>
</ol>
<p>$$\frac{72 \times 131}{2}=4716$$</p>
<p>If you're wondering why this works, I suggest checking out the video again in the study plan.</p>