We have the following sequence:
```python
f(0) = 0
f(1) = 1
f(2) = 1
f(3) = 2
f(4) = 4;
f(n) = f(n-1) + f(n-2) + f(n-3) + f(n-4) + f(n-5);
```

Your task is to give the number of total values for the odd terms of the sequence  up to the n-th term (included). (The number n (of n-th term) will be given as a positive integer)

The values 1 (one) is the only that is duplicated in the sequence and should be counted only once.

E.g. 
```
count_odd_pentaFib(5) -----> 1 # because the terms up to 5 are: 0, 1, 1, 2, 4, 8 (only 1 is odd and counted once)
```
Other examples:
```
 count_odd_pentaFib(10) ------> 3 #because the odds terms are: [1, 1, 31, 61] (three different values)

count_odd_pentaFib(15) ------> 5 # beacause the odd terms are: [1, 1, 31, 61, 1793, 3525] (five different values)
```
Good luck !!

(Your code should be fast. Many moderate high values will be waiting to test it.)

Difficulty: EASY
Tags: Dynamic programming

Fundamentals

Mathematics
Skill types: Dynamic programming

Starter code:
def count_odd_pentaFib(n):
	

Solutions:
def count_odd_pentaFib(n):
	return 2 * (n // 6) + [0, 1, 2, 2, 2, 2][n % 6] - (n >= 2)


buf = [0, 1, 1, 2, 4]

def count_odd_pentaFib(n):
	while len(buf) <= n:
		buf.append(sum(buf[-5:]))
	return len([i for i in set(buf[:n + 1]) if i & 1])


def count_odd_pentaFib(n):
	if n == 0:
		return 0
	if n < 5:
		return 1
	i = 4
	cnt = 1
	(a, b, c, d, e) = (0, 1, 1, 2, 4)
	while i < n:
		(a, b, c, d, e) = (b, c, d, e, a + b + c + d + e)
		if e % 2 == 1:
			cnt += 1
		i += 1
	return cnt


def count_odd_pentaFib(n):
	st = [0, 1]
	count = 0
	if 0 < n < 2:
		return 1
	if n <= 0:
		return 0
	while n >= 2:
		if sum(st[-5:]) % 2 != 0:
			count += 1
		st.append(sum(st[-5:]))
		n -= 1
	return count


penta_fib_table = {0: 0, 1: 1, 2: 1, 3: 2, 4: 4}

def penta_fib(n):
	if n in penta_fib_table:
		return penta_fib_table[n]
	return penta_fib(n - 1) + penta_fib(n - 2) + penta_fib(n - 3) + penta_fib(n - 4) + penta_fib(n - 5)

def count_odd_pentaFib(n):
	odd_terms = []
	for i in range(1, n + 1):
		penta_fib_i = penta_fib(i)
		penta_fib_table[i] = penta_fib_i
		if penta_fib_i % 2 == 1:
			odd_terms.append(penta_fib_i)
	return len(set(odd_terms))


from functools import lru_cache

@lru_cache()
def pentabonacci(n):
	return n if n in (0, 4) else 1 if n in (1, 2) else 2 if n == 3 else sum((pentabonacci(n - k) for k in range(1, 6)))

def count_odd_pentaFib(n):
	return sum((1 for i in range(n + 1) if pentabonacci(i) % 2)) - (1 if n > 1 else 0)


from collections import deque

def count_odd_pentaFib(n):
	if n == 0:
		return 0
	elif n < 6:
		return 1

	def pentabonacci(max_term):
		terms = deque((1, 1, 2, 4, 8), 5)
		m = max_term - 5
		for i in range(m):
			next_term = sum(terms)
			yield next_term
			terms.append(next_term)
	return len(set((term for term in pentabonacci(n) if term % 2 == 1))) + 1


from collections import deque
from itertools import islice, groupby

def odd_penta_fib():
	q = deque([0, 1, 1, 2, 4, 8], maxlen=6)
	while True:
		yield q[0]
		q.append(q[-1] * 2 - q[0])

def count_odd_pentaFib(n):
	return sum((1 for (key, grp) in groupby(islice(odd_penta_fib(), n + 1)) if key % 2 == 1))


vector = [0, 1, 1, 2, 4]
answers = [0, 1, 1, 1, 1]
for i in range(43996):
	vector = vector[1:] + [sum(vector)]
	answers.append(answers[-1] + vector[-1] % 2)

def count_odd_pentaFib(n):
	return answers[n]