Anonymous user
Luhn test of credit card numbers: Difference between revisions
→{{header|Octave}}: change int2str to mat2str because mat2str supports larger numbers
(→{{header|C}}: simplify rule 3) |
(→{{header|Octave}}: change int2str to mat2str because mat2str supports larger numbers) |
||
Line 1,214:
=={{header|Octave}}==
<lang Octave> function y = isluhn(s);
if isnumeric(s) s =
d = s-'0'; % convert string into vector of digits
m = [2:2:8,1:2:9]; % rule 3: maps [1:9] -> i
|