In recreational mathematics, a [Keith number](https://en.wikipedia.org/wiki/Keith_number) or repfigit number (short for repetitive Fibonacci-like digit) is a number in the following integer sequence:

`14, 19, 28, 47, 61, 75, 197, 742, 1104, 1537, 2208, 2580, 3684, 4788, 7385, 7647, 7909, ...` (sequence A007629 in the OEIS)

Keith numbers were introduced by Mike Keith in 1987. They are computationally very challenging to find, with only about 100 known.

Implement the code to check if the given number is a Keith number. Return the number number of iteration needed to confirm it; otherwise return `false`.

**Note:** 1-digit numbers are **not** Keith numbers by definition


## Examples

```
n = 197      # --> [1, 9, 7]

# calculation           iteration
1 + 9 + 7 = 17         #    1
9 + 7 + 17 = 33        #    2
7 + 17 + 33 = 57       #    3
17 + 33 + 57 = 107     #    4
33 + 57 + 107 = 197    #    5
```
As `197` is the same as the initial number, so it's a Keith number: return `5`


Another example:
```
n = 196

# calculation          iteration
1 + 9 + 6 = 16        #    1
...
```

`196` is not a Keith number, so return `false`

Difficulty: EASY
Starter code: def is_keith_number(n):
	

Solutions:
def is_keith_number(n):
	numList = [int(i) for i in str(n)]
	if len(numList) > 1:
		itr = 0
		while numList[0] <= n:
			numList[itr % len(numList)] = sum(numList)
			itr += 1
			if n in numList:
				return itr
	return False


def is_keith_number(n):
	(turn, seq) = (0, [int(d) for d in str(n)])
	while seq[-1] < n:
		seq = seq[1:] + [sum(seq)]
		turn += 1
	return n > 9 and seq[-1] == n and turn


from collections import deque
from itertools import count, dropwhile

def iter_seq(init):
	ds = deque(map(int, str(init)))
	while True:
		n = sum(ds)
		yield n
		ds.popleft()
		ds.append(n)

def is_keith_number(n):
	if n < 10:
		return False
	(i, d) = next(dropwhile(lambda x: x[1] < n, enumerate(iter_seq(n), 1)))
	return i if d == n else False


def is_keith_number(n):
	i = 0
	terms = list(map(int, str(n)))
	while terms[-1] < n:
		i += 1
		terms = terms[1:] + [sum(terms)]
	return terms[-1] == n and i


def is_keith_number(n):
	s = list(map(int, str(n)))
	l = len(s)
	while s[-1] < n:
		s.append(sum(s[-l:]))
	return len(s) - l if n in s else False


def is_keith_number(n):
	if n <= 10:
		return False
	(c, k_lst, k_num) = (0, list(str(n)), n)
	while k_num <= n:
		k_num = sum([int(x) for x in k_lst])
		c += 1
		if k_num == n:
			return c
		k_lst.append(k_num)
		k_lst.pop(0)
	return False


def is_keith_number(n):

	def rec(ds, i):
		d = sum(ds)
		ds = ds[1:]
		ds.append(d)
		return i if d == n else False if d > n else rec(ds, i + 1)
	return False if n < 10 else rec([int(x) for x in list(str(n))], 1)


def is_keith_number(n):
	if n < 10:
		return False
	x = list(map(int, str(n)))
	(y, i) = (sum(x), 1)
	while y < n:
		(i, x, y) = (i + 1, x[1:] + [y], 2 * y - x[0])
	return i * (y == n)


def is_keith_number(n):
	res = [int(x) for x in str(n)]
	tmp = sum(res)
	cnt = 1
	while tmp < n:
		cnt += 1
		res.pop(0)
		res.append(tmp)
		tmp = sum(res)
		if tmp == n:
			return cnt
	return False


from itertools import count

def is_keith_number(n):
	lst = list(map(int, str(n)))
	s = sum(lst)
	for i in count(1):
		if s >= n:
			return n > 9 and s == n and i
		(lst, s) = (lst[1:] + [s], s * 2 - lst[0])