_This kata is based on [Project Euler Problem 546](https://projecteuler.net/problem=546)_

# Objective

Given the recursive sequence 

fk(n) =


∑

i
=
0


n



fk(floor(i / k)) where fk(0) = 1

Define a function `f` that takes arguments `k` and `n` and returns the nth term in the sequence fk

## Examples

`f(2, 3)` = f2(3) = 6

`f(2, 200)` = f2(200) = 7389572

`f(7, 500)` = f7(500) = 74845

`f(1000, 0)` = f1000(0) = 1


**Note:** 
No error checking is needed, `k` ranges from 2 to 100 and `n` ranges between 0 and 500000 (mostly small and medium values with a few large ones)


As always any feedback would be much appreciated

Difficulty: EASY
Starter code: def f(k, n):
	

Solutions:
def f(k, n):
	a = []
	for i in range(0, n + 1):
		if i < k:
			a += [i + 1]
		else:
			a += [a[-1] + a[i // k]]
	return a[-1]


def f(k, n):
	memo = [1]
	for i in range(1, n + 1):
		memo.append(memo[-1] + memo[i // k])
	return memo[-1]


def f(k, n):
	if n == 0:
		return 1
	res = 1
	j = 1
	seq = [1]
	for i in range(1, n + 1):
		if i % k == 0:
			j = seq[i // k]
		res += j
		seq.append(res)
	return res


def f(k, n):
	fk = [*range(1, k + 1)]
	x = 2
	for i in range(k + 1, n + 2):
		fk += [fk[-1] + x]
		if i % k == 0:
			x = fk[i // k]
	return fk[n]


from math import floor

def f(k, n):
	table = [1]
	if n == 0:
		return table[n]
	else:
		for i in range(1, n + 1):
			table.append(table[i - 1] + table[floor(i / k)])
	return table[-1]


def f(k, n):
	(g, r, c) = ([], 1, 0)
	for i in range(n // k):
		c += k * r
		g.append(r)
		r += g[(i + 1) // k]
	return c + r * (n % k + 1)


def f(k, n):
	r = [1]
	diff = 0
	c = 1
	while n >= len(r):
		r.append(r[-1] + r[diff])
		c += 1
		if c == k:
			c = 0
			diff += 1
	return r[n]


def f(k, n):
	xs = [1]
	for i in range(1, n + 1):
		xs.append(xs[-1] + xs[i // k])
	return xs[-1]