We define the sequence ```SF``` in the following way in terms of four previous sequences: ```S1```, ```S2```, ```S3``` and ```ST```



We are interested in collecting the terms of SF that are multiple of ten.

The first term multiple of ten of this sequence is  ```60```

Make the function ```find_mult10_SF()``` that you introduce the ordinal number of a term multiple of 10 of SF and gives us the value of this term.

Let's see some cases: 
```python
find_mult10_SF(1) == 60

find_mult10_SF(2) == 70080

find_mult10_SF(3) ==  90700800
```
``` haskell
findMult10SF 1 `shouldBe` 60
findMult10SF 2 `shouldBe` 70080
findMult10SF 3 `shouldBe` 90700800
```
Memoization is advisable to have a more agile code for tests.

Your code will be tested up to the 300-th term, multiple of 10.

Happy coding!!

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Sorting

Dynamic programming

Mathematics

Data structures

Starter code: def find_mult10_SF(n):
	

Solutions:
def find_mult10_SF(n):
	n = 4 * n - 1
	return (6 ** n + 3 * 2 ** n) / 4


s1 = lambda n: 1 + 2 ** n + 3 ** n
s2 = lambda n: 1 + 2 ** n + 4 ** n
s3 = lambda n: 1 + 2 ** n + 3 ** n + 4 ** n + 5 ** n + 6 ** n
st = lambda n: s3(n) - s2(n) - s1(n)
sf = lambda n: (st(n + 1) - 5 * st(n) - 4) / 4

def find_mult10_SF(n):
	i = 1
	k = 0
	result = None
	while k < n:
		s = sf(i)
		i = i + 1
		if s % 10 == 0:
			k = k + 1
			result = s
	return result


def find_mult10_SF(n):
	return 16 ** n * (81 ** n + 9) // 24


find_mult10_SF = lambda n: 81 ** n // 3 + 3 << 4 * n - 3


s1 = lambda n: 1 + 2 ** n + 3 ** n
s2 = lambda n: 1 + 2 ** n + 4 ** n
s3 = lambda n: 1 + 2 ** n + 3 ** n + 4 ** n + 5 ** n + 6 ** n
st = lambda n: s3(n) - s2(n) - s1(n)
sf = lambda n: (st(n + 1) - 5 * st(n) - 4) / 4
mem = []

def find_mult10_SF(n):
	x = mem[-1][0] + 1 if mem else 1
	while len(mem) < n:
		s = sf(x)
		while s % 10 != 0:
			x += 1
			s = sf(x)
		mem.append((x, s))
		x += 1
	return mem[n - 1][1]


(A, x) = ([], 1)
while len(A) < 300:
	r = (6 ** x + 3 * 2 ** x) // 4
	if not r % 10:
		A.append(r)
	x += 1

def find_mult10_SF(n):
	return A[n - 1]


from itertools import count

def S_F(n):
	return 2 ** (-2 + n) * (3 + 3 ** n)

def find_mult10_SF(n):
	i = 0
	while n:
		i += 1
		sf = S_F(i)
		n -= sf % 10 == 0
	return sf


ST = lambda n: 6 ** n + 5 ** n - 2 ** n - 1
SF = lambda x, y: (x - 5 * y - 4) // 4
result = []

def gen():
	(previous, n) = (ST(0), 1)
	while True:
		current = ST(n)
		val = SF(current, previous)
		if not val % 10:
			yield val
		(previous, n) = (current, n + 1)
values = gen()

def find_mult10_SF(n):
	while len(result) < n:
		result.append(next(values))
	return result[n - 1]


d = []
s1 = lambda n: 1 + 2 ** n + 3 ** n
s2 = lambda n: 1 + 2 ** n + 4 ** n
s3 = lambda n: sum((i ** n for i in range(1, 7)))
st = lambda n: s3(n) - s2(n) - s1(n)
for i in range(1500):
	r = (st(i + 1) - 5 * st(i) - 4) // 4
	if not r % 10:
		d.append(r)
find_mult10_SF = lambda n: d[n - 1]