Skip to content

Instantly share code, notes, and snippets.

@evanmiller
evanmiller / gist:5834171
Last active December 18, 2015 19:39 — forked from pragdave/gist:5833805
defmodule CheckDigit do
import Enum
@doc """
Determine if a sequence of digits is valid, assuming the last digit is
a Luhn checksum. (http://en.wikipedia.org/wiki/Luhn_algorithm)
"""
def valid?(numbers) when is_list(numbers) do