<s>[INST] nth term of the sequence 1,2,3,5,7,9............ what will be the formula for finding the nth term of a series in which the difference between the terms increase by 1 after every k elements
For example (for k = 3) : 1,2,3,5,7,9,12,15,18........
(k=2) : 1,2,4,6,9,12,16,20,25......
i found some formula for smaller values of k (2,3,4,5)
for k=1 : floor(((2n+1)*(2n+1))/8)
k=2 :floor(((n+1)*(n+1))/4)
i tried to look for a pattern in these formula and i found for k>2:
if k is even : floor((n+k/2)^2)/(2*k))
if k is odd : floor(n+k/2)*(n+k/2+1)/(2*k))
but these do not hold true for k>=10
 [/INST] For positive integers $n$ and $k$ we find: $$a_{nk}=\left(1+2+\cdots+n\right)k=\frac{1}{2}\left(n+1\right)nk$$
Then for $r\in\left\{ 1,2,\dots,k\right\} $ we find: $$a_{nk+r}=a_{nk}+\left(n+1\right)r=\frac{1}{2}\left(n+1\right)nk+\left(n+1\right)r=\frac{1}{2}\left(n+1\right)\left(nk+2r\right)$$
Setting $m=nk+r$ we find:


*

*$\lceil\frac{m}{k}\rceil=n+1$ and 

*$m-k\lceil\frac{m}{k}\rceil+k=nk+r-nk-k+k=r$
so that: $$a_{m}=a_{nk+r}=\frac{1}{2}\lceil\frac{m}{k}\rceil\left(m+r\right)=\frac{1}{2}\lceil\frac{m}{k}\rceil\left(2m-k\lceil\frac{m}{k}\rceil+k\right)$$
</s>