Anatomy of the number
In a Visa test number the leading 4 is the brand prefix, the middle digits are random, and the last digit is the Luhn check digit computed from the rest.
4XXX XXXX XXXX XXXC
C = (10 − (Luhn sum of the first 15 digits mod 10)) mod 10