In this Kata, you will implement the [Luhn Algorithm](http://en.wikipedia.org/wiki/Luhn_algorithm), which is used to help validate credit card numbers.

Given a positive integer of up to 16 digits, return ```true``` if it is a valid credit card number, and ```false``` if it is not.

Here is the algorithm:
  
* Double every other digit, scanning **from right to left**, starting from the second digit (from the right).

  Another way to think about it is: if there are an **even** number of digits, double every other digit starting with the **first**; if there are an **odd** number of digits, double every other digit starting with the **second**:

  ```
  1714 ==> [1*, 7, 1*, 4] ==> [2, 7, 2, 4]
  
  12345 ==> [1, 2*, 3, 4*, 5] ==> [1, 4, 3, 8, 5]
  
  891 ==> [8, 9*, 1] ==> [8, 18, 1]
  ```

*  If a resulting number is greater than `9`, replace it with the sum of its own digits (which is the same as subtracting `9` from it):

  ```
  [8, 18*, 1] ==> [8, (1+8), 1] ==> [8, 9, 1]
  
  or:
  
  [8, 18*, 1] ==> [8, (18-9), 1] ==> [8, 9, 1]
  ```
  
* Sum all of the final digits:

  ```
  [8, 9, 1] ==> 8 + 9 + 1 = 18
  ```

* Finally, take that sum and divide it by `10`.  If the remainder equals zero, the original credit card number is valid.
    ```
    18 (modulus) 10 ==> 8 , which is not equal to 0, so this is not a valid credit card number
    ```

```if:fsharp,csharp
For F# and C# users:

The input will be a string of spaces and digits `0..9`

```

Source: codewars | Difficulty: EASY

Starter code: def validate(n):
	

Solutions:
def validate(n):
	digits = [int(x) for x in str(n)]
	even = [x * 2 if x * 2 <= 9 else x * 2 - 9 for x in digits[-2::-2]]
	odd = [x for x in digits[-1::-2]]
	return sum(even + odd) % 10 == 0


import numpy as np

def validate(cc_number):
	arr = np.array([int(i) for i in str(cc_number)])
	arr[-2::-2] *= 2
	arr[arr > 9] -= 9
	return np.sum(arr) % 10 == 0


def validate(n):
	i = 0
	sum = 0
	while n:
		digit = n % 10
		n //= 10
		if i % 2 == 1:
			digit *= 2
		if digit > 9:
			digit -= 9
		sum += digit
		i += 1
	return sum % 10 == 0


def validate(n):
	step1 = [int(x) * 2 if idx % 2 else int(x) for (idx, x) in enumerate(str(n)[::-1])]
	step2 = [x - 9 if x > 9 else x for x in step1[::-1]]
	step3 = sum(step2)
	return not step3 % 10


def validate(n):
	return not sum((sum(map(int, str(int(d) + i % 2 * int(d)))) for (i, d) in enumerate(str(n)[::-1]))) % 10


def validate(n):
	x = [int(c) if not i % 2 else int(c) * 2 for (i, c) in enumerate(str(n)[::-1])]
	return sum([c if c < 9 else c - 9 for c in x]) % 10 == 0


def validate(n):
	list = []
	for (index, number) in enumerate(reversed(str(n))):
		list.append(int(number) * 2 if index % 2 != 0 else int(number))
	return sum([digit - 9 if digit > 9 else digit for digit in list]) % 10 == 0