In your class, you have started lessons about [arithmetic progression](https://en.wikipedia.org/wiki/Arithmetic_progression). Since you are also a programmer, you have decided to write a function that will return the first `n` elements of the sequence with the given common difference `d` and first element `a`. Note that the difference may be zero!

The result should be a string of numbers, separated by comma and space.

## Example

```python
# first element: 1, difference: 2, how many: 5
arithmetic_sequence_elements(1, 2, 5) == "1, 3, 5, 7, 9"
```

~~~if:fortran
*NOTE: In Fortran, your returned string is* **not** *permitted to contain redundant leading/trailing whitespace.*
~~~

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Data structures

Starter code: def arithmetic_sequence_elements(a, r, n):
	

Solutions:
def arithmetic_sequence_elements(a, r, n):
	return ', '.join((str(a + b * r) for b in range(n)))


def arithmetic_sequence_elements(a, r, n):
	return ', '.join((str(a + r * i) for i in range(n)))


from itertools import count, islice

def arithmetic_sequence_elements(a, r, n):
	return ', '.join([str(x) for x in islice(count(a, r), n)])


def arithmetic_sequence_elements(a, r, n):
	return ', '.join((str(a + r * x) for x in range(n)))


def arithmetic_sequence_elements(a, r, n):
	rng = list(range(a, a + r * n, r)) if r != 0 else [a] * n
	return ', '.join(map(str, rng))


def arithmetic_sequence_elements(a, r, n):
	z = str(a)
	for i in range(n - 1):
		a = a + r
		z = z + ', ' + str(a)
	return z


def arithmetic_sequence_elements(a, r, n):

	def seq(a, r, n):
		while n > 0:
			yield a
			n -= 1
			a += r
	return ', '.join(map(str, seq(a, r, n)))


def arithmetic_sequence_elements(a, r, n):
	out = [str(a)]
	for i in range(n - 1):
		a += r
		out.append(str(a))
	return ', '.join(out)


def arithmetic_sequence_elements(a, r, n):
	result = str(a)
	list_ = [a]
	for i in range(n - 1):
		result += ', ' + str(list_[-1] + r)
		list_.append(list_[-1] + r)
	return result