Consider a sequence generation that follows the following steps. We will store removed values in variable `res`. Assume `n = 25`:
```Haskell
-> [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25] Let's remove the first number => res = [1]. We get..
-> [2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]. Let's remove 2 (so res = [1,2]) and every 2-indexed number. We get..
-> [3,5,7,9,11,13,15,17,19,21,23,25]. Now remove 3, then every 3-indexed number. res = [1,2,3]. 
-> [5,7,11,13,17,19,23,25]. Now remove 5, and every 5-indexed number. res = [1,2,3,5]. We get..
-> [7,11,13,17,23,25]. Now remove 7 and every 7-indexed. res = [1,2,3,5,7].  
But we know that there are no other 7-indexed elements, so we include all remaining numbers in res. So res = [1,2,3,5,7,11,13,17,23,25] and sum(res) = 107.

Note that when we remove every n-indexed number, we must remember that indices start at 0. So for every 3-indexed number above:
[3,5,7,9,11,13,15,17,19,21,23], we remove index0=3, index3= 9, index6=15,index9=21, etc.

Note also that if the length of sequence is greater than x, where x is the first element of the sequence, you should continue the remove step: remove x, and every x-indexed number until the length of sequence is shorter than x. In our example above, we stopped at 7 because the the length of the remaining sequence [7,11,13,17,23,25] is shorter than 7.
```
You will be given a number `n` and your task will be to return the sum of the elements in res, where the maximum element in res is `<= n`. 

For example:

```Python
Solve(7) = 18, because this is the sum of res = [1,2,3,5,7].
Solve(25) = 107
```

More examples in the test cases. 

Good luck!

Source: codewars | Difficulty: EASY

Starter code: def solve(n):
	

Solutions:
def solve(n):
	zoznam = [int(i) for i in range(2, n + 1)]
	res = [1]
	while zoznam != []:
		res.append(zoznam[0])
		del zoznam[0::zoznam[0]]
	return sum(res)


def solve(n):
	(presum, arr) = (1, list(range(2, n + 1)))
	while arr[0] < len(arr):
		presum += arr[0]
		del arr[::arr[0]]
	return presum + sum(arr)


def solve(n):
	xs = list(range(2, n + 1))
	res = 1
	while xs[0] < len(xs):
		res += xs[0]
		del xs[::xs[0]]
	return res + sum(xs)


def solve(n):
	a = [1]
	n = list(range(2, n + 1))
	while len(n) > n[0]:
		nn = n[:]
		a.append(n[0])
		n = [i for (z, i) in enumerate(nn) if z % n[0] != 0 and z != 0]
	a += n
	return sum(a)


def solve(n):
	(li, r) = (list(range(2, n + 1)), [1])
	while 1:
		r.append(li[0])
		if li[0] > len(li):
			return sum(r + li[1:])
		li = [li[j] for j in range(1, len(li)) if j % li[0] != 0]


def solve(n):
	(l, seq) = ([1], [i for i in range(2, n + 1)])
	while l[-1] <= len(seq):
		l.append(seq.pop(0))
		del seq[l[-1] - 1::l[-1]]
	return sum(l + seq)


def solve(n):
	res = []
	x = list(range(2, n + 1))
	while True:
		res.append(x.pop(0))
		if res[-1] > len(x):
			break
		for i in range(res[-1] - 1, len(x), res[-1]):
			x[i] = 0
		x = [i for i in x if i]
		if len(x) == 0:
			break
	return 1 + sum(res) + sum(x)


def solve(n):
	r = [1, 2]
	a = list(range(3, n + 1, 2))
	while len(a) > a[0]:
		x = a[0]
		a = [y for (i, y) in enumerate(a) if i % x != 0]
		r.append(x)
	return sum(a + r)


def solve(n):
	lst = list(range(2, n + 1))
	res = [1]
	while lst and len(lst) > lst[0]:
		idx = lst[0]
		lst = [x for (i, x) in enumerate(lst) if i % idx]
		res.append(idx)
	return sum(res) + sum(lst)


def solve(n):
	arr = [i + 1 for i in range(n)]
	arr2 = list()
	while len(arr) >= 1:
		arr2.append(arr[0])
		del arr[0]
		for j in range(1, n):
			if arr2[-1] == 1 or arr2[-1] * j - j >= len(arr):
				break
			else:
				del arr[arr2[-1] * j - j]
	sum = 0
	for i in arr2:
		sum += int(i)
	return sum