Task 156 Luhn Algorithm

Back to Problem Solutions forum

crydolphin666     2020-10-19 18:53:21

For some reason I've got an error in this test case:
Was: 1097696166985934
Expected: 1907696166985934

But hash sum of both numbers is 80.
So my answer was obviously 1097696166985934
How should I detect swap error in such test cases? In my opinion this test case shows how inapplicable Luhn Algorithm for error's detection.
While writting this topic I've found the confrmation of my words in this article Luhn Algorithm
I guess you should rework your test cases.

Please login and solve 5 problems to be able to post at forum