Let $k$ be a fixed integer and consider the sequence $1, k, k+1, 2k, 2k+1, 3k, 3k+1, 4k, 4k+1, \dotsc$. Is there a closed form for this sequence? Let $k$ be a fixed integer and consider the sequence
$$1, k, k+1, 2k, 2k+1, 3k, 3k+1, 4k, 4k+1, \dotsc.$$
These are all the integers that are congruent to either 0 or 1 mod $k$.
It is immediate that for $k=2$, the sequence in closed form is $a_n = n$ if we use $n$ to index. However, for larger fixed $k$ I am not able to work out a closed form. Initially I tried using floor/ceilings but I could not find anything to account for the alternating sized gaps between terms. Does such a form even exist? 
 A: The following gives $a_0=1, a_1=k, a_2=k+1, a_3=2k, \,\dots\,$:
$$
a_n = \left\lfloor \frac{n+1}{2} \right\rfloor \, k + (n+1) \bmod 2
$$
A: If you are willing to prepend a zero then there is a straightforward way:
If $n=0,1,2,3,4,5,...$ then
$\lfloor {n \over 2}\rfloor =0,0,1,1,2,2,...$ and
$n-2\lfloor {n \over 2}\rfloor = 0,1,0,1,0,1,...$
and so the sequence can be written as
$k \lfloor {n \over 2}\rfloor + n-2\lfloor {n \over 2}\rfloor$.
A: We can try something of the form
$$a_n=\alpha n+\beta (-1)^nn+\gamma.$$
From $$\begin{align}\alpha(2n+1)+2\gamma&=a_n+a_{n+1}\\&=(k+1, 2k+1,3k+1,4k+1, 5k+1,\ldots )\\&=nk+1,\end{align}$$
we find $\alpha=\frac k2$, $\gamma=\frac12-\frac k4$. From this we infer $\beta=\frac k4-\frac12$, and - hooray! - that works.
A: From observation, 
$$\begin{aligned}
&\begin{cases}T_{2m}&=mk\\\\
T_{2m+1}&=mk+1\end{cases}\\
\\
\Longrightarrow
&\begin{cases}\text{For even $n$:} \;\;\quad  T_n&=\displaystyle\frac n2k\\
\text{For odd $n$:}\qquad  T_n&=\displaystyle\frac {n-1}2k+1\;\;=\frac n2k+(1-\frac k2)\end{cases}\end{aligned}$$
Summarising both cases,
$$T_n
=\frac n2k+\left(n-2\bigg\lfloor\frac n2\bigg\rfloor\right)\left(1-\frac k2\right)
=\color{red}{n+\left(k-2\right)\bigg\lfloor\frac n2\bigg\rfloor}$$
A: A    variation:
\begin{align*}
&a_0=1,\ a_2=k+1,\ a_4=2k+1,\ \ \ldots,\qquad\qquad &a_{2n}&=nk+1\qquad\qquad &n\geq 0\\
&a_1=k,\ a_3=2k,\ \ \ \ \ \ a_5=3k,\ \ \ \ \ \ \ \ \ \ldots,\qquad\qquad &a_{2n-1}&=nk\qquad\qquad &n\geq 1\\
\end{align*}

It follows   for $n\geq 0$
  \begin{align*}
\color{blue}{a_n}&=\left(\frac{nk}{2}+1\right)\cdot\frac{1+(-1)^n}{2}+\frac{(n+1)k}{2}\cdot\frac{1-(-1)^n}{2}\tag{1}\\
&\color{blue}{=\frac{1}{2}\left(nk+1+(-1)^n+k\cdot\frac{1-(-1)^n}{2}\right)}
\end{align*}

Note:


*

*The first part in (1) respects even indices: $2l=n\rightarrow l=\frac{n}{2}$.

*The second part in (1) covers odd indices: $2l-1=n\rightarrow  l=\frac{n+1}{2}$.
