I just discovered today an intersting Gist from Thomas Fuchs. This is an implementation of the Luhn 10 algorithm also known as “modulus 10” algorithm.
In this Gist I also learned a new way to convert a string in an integer:
d = ~~a[b];
Here the gist: