Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var isDivisibleBy13 = function(test) {
- if (Math.abs(test) === 13 || test % 13 === 0) {
- return true;
- }
- var lastDigit = +String(number).slice(-1),
- remainingDigits = +String(test).slice(0, -1);
- if (test >= 13 && (remainingDigits - (lastDigit * 9)) % 13 === 0) {
- return isDivisibleBy13(remainingDigits);
- }
- return false;
- };
Add Comment
Please, Sign In to add comment