As part of a code that I want to implement more efficiently, I would like to find a closed form expression for the following sequence of length $N+L-1$ (the elements of the sequence are separated by comma):
$1,\, 2,\, 3,\, \ldots N-1,\, N,\, N,\, \ldots N,\, N,\, N-1,\, \ldots 3,\, 2,\, 1$
I have tried to find a relationship between the position of each number and its value by subtracting by some numbers, taking absolute values, dividing by a number and taking the integer part, but so far I haven't been able to get a closed form expression. Any hint or answer would be appreciated.
By closed form expression, I mean a formula that gives the value of the $k$-th term in the sequence given the positive integers $L$ and $N$. I am looking for an expression that is not defined by intervals, but that works for any value of $k$.