Counting Credit Cards The credit cards (VISA CARDS & MASTER CARDS) numbers have the following properties;
Let $N$ be the card number


*

*$N$ has $16$ digits; $N = a_{1}a_{2}a_{3}...a_{16}$ where $a_{k}$ is the $k$-th digit of $N$

*$a_1$ $\neq 0$ 

*$2(a_1+a_3+a_5 + ... + a_{15}) + (a_{2}+a_{4}+a_{6}+...+a_{16})$ $+$ count$(\geq 5; a_1,a_3,a_5,...,a_{15})$ $\equiv0$ (mod $10$)


Now consider the following example to clarify the question;
The card number $N$ is $5529\,4203\,5061\,5465$
Clearly $N$ has $16$ digits,
$a_{1}\ne0$,
and $2(5+2+4+0+5+6+5+6) + (5+9+2+3+0+1+4+5)$ $+$ count$(\geq 5; 5,2,4,0,5,6,5,6)$
$=2(33)+29+5=100$ $\equiv 0$ (mod $10$)
How many $N$ are there?

The answer is $9\cdot10^{14}$.  That is, there are $9$ choices for $a_1$ followed by $10$ choices for each of $a_2$ to $a_{15}$, and ending with the unique value
$$a_{16}=-2(a_1+a_3+\cdots+a_{15})-(a_2+a_4+\cdots+a_{14})-\text{count}(\ge5;a_1,a_3\ldots,a_{15})\mod 10$$
Remark: The OP's formula looks different from the Luhn formula for the check digit, which says to double the values of $a_1,a_3,\ldots,a_{15}$ and then sum the digits of those numbers, along with the digits $a_2,a_4,\ldots,a_{14}$.  What reconciles the two formulas is the observation that the sum of the digits of $2a$ is congruent mod $10$ to $2a+1$ if $a\ge5$.
