Jump to content

Luhn test of credit card numbers: Difference between revisions

Add bruijn
(added Easylang)
(Add bruijn)
Line 1,827:
$ echo 1234567812345670 | beef luhn.bf
Pass</pre>
 
=={{header|Bruijn}}==
<syntaxhighlight lang="bruijn">
:import std/Combinator .
:import std/Math .
:import std/List .
 
luhn number→list → reverse → check → (\mod (+10)) → zero?
check y [[[[0 [[[6 \5 (4 + (5 odd even)) 1]]] 1]]]] k (+0)
odd 2
even digit-sum (2 ⋅ (+2))
 
:test (luhn (+61789372994)) ([[1]])
:test (luhn (+49927398716)) ([[1]])
:test (luhn (+49927398717)) ([[0]])
:test (luhn (+1234567812345678)) ([[0]])
:test (luhn (+1234567812345670)) ([[1]])
</syntaxhighlight>
 
=={{header|Burlesque}}==
55

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.