The number of visits is an arithmetic sequence.
There are ' n ' terms. They're just the counting numbers from 1 to 'n' .
The first term is 1, the second term is 2, ... , the last term is 'n' .
The formula for finding the sum of an arithmetic sequence is
Sum = n (first term + last term)/2 .
This formula is indicating that the sum of the arithmetic sequence
is just equal to the average of the first and last term, multiplied by
the number of terms.
So the number of visits is
n (1 + n)/2 .