Talk:Luhn algorithm: Difference between revisions

Content deleted Content added
Ruby Solution: two bug fixes: right-to-left; each_with_index seems to start with the index 0, not 1
Line 214:
def luhn10?(number)
checksum = 0
digits = split_integer(number).reverse
digits.each_with_index do |d,i|
checksum += i % 2 == 01 ? sum_digits(d*2) : d
end
(checksum % 10) == 0
Line 231:
end
</source>
 
{{unsigned}}
 
Bug fixes. [[User:Boud|Boud]] ([[User talk:Boud|talk]]) 21:23, 24 February 2015 (UTC)
 
== description incorrect 4/17/2013 ==