https://math.stackexchange.com/q/2778278/290189

You’ve got the right ingredients. (Pair up first term and last term and calculate number of terms.) However, with Gauss’s idea of pairing up the first and the last terms, you may consider condensing your work by one single formula.

$\text{required sum} = \frac{(\text{first term} + \text{last term}) \times \text{number of terms}}{2} \\ = \frac{(\text{first term} + \text{last term}) \times (\frac{\text{last term} - \text{first term}}{\text{common difference}}+1)}{2}$

# Vincent Tam

## May 1, 2018

Post id: 2760540
Backup version on Evernote

I wanted to answer, but OP deleted own post before I clicked the submit button.

My solution:

$E[|X|] = 2E[X1_{X \ge 0}]$
$= 2E[\sigma Z 1_{Z \ge 0}] \qquad (Z \sim \mathcal{N}(0,1))$
$= 2 \sigma \int_0^\infty \frac{1}{\sqrt{2\pi}} xe^{-x^2/2} \,\mathrm{d}x$
$= \frac{\sqrt2 \sigma}{\sqrt{\pi}} \int_0^\infty e^{-x^2/2} \,\mathrm{d}\left(\frac{x^2}{2}\right)$
$= \frac{\sqrt2 \sigma}{\sqrt{\pi}} \left[ -e^{x^2/2} \right]_0^\infty$
$= \frac{\sqrt2 \sigma}{\sqrt{\pi}} [-0 -(-1)]$
$= \frac{\sqrt2 \sigma}{\sqrt{\pi}}$

# Vincent Tam

## May 1, 2018

Post id: 2760507
Backup version on Evernote

The comment is too quick for spam to exist on Math.SE.

# Vincent Tam

## April 30, 2018

Post id: 2726702
No, the prime number $p = 211$ also satisfies the property in the question.
$\begin{matrix} n & T_n & p - T_n & \text{Is it a prime?} \\ \hline 1 & 1 & 210 & \text{false} \\ 2 & 3 & 208 & \text{false} \\ 3 & 6 & 205 & \text{false} \\ 4 & 10 & 201 & \text{false} \\ 5 & 15 & 196 & \text{false} \\ 6 & 21 & 190 & \text{false} \\ 7 & 28 & 183 & \text{false} \\ 8 & 36 & 175 & \text{false} \\ 9 & 45 & 166 & \text{false} \\ 10 & 55 & 156 & \text{false} \\ 11 & 66 & 145 & \text{false} \\ 12 & 78 & 133 & \text{false} \\ 13 & 91 & 120 & \text{false} \\ 14 & 105 & 106 & \text{false} \\ 15 & 120 & 91 & \text{false} \\ 16 & 136 & 75 & \text{false} \\ 17 & 153 & 58 & \text{false} \\ 18 & 171 & 40 & \text{false} \\ 19 & 190 & 21 & \text{false} \\ 20 & 210 & 1 & \text{false} \end{matrix}$