Guest User

Untitled

a guest
Nov 18th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. var isDivisibleBy13 = function(test) {
  2. if (Math.abs(test) === 13 || test % 13 === 0) {
  3. return true;
  4. }
  5. var lastDigit = +String(number).slice(-1),
  6. remainingDigits = +String(test).slice(0, -1);
  7.  
  8. if (test >= 13 && (remainingDigits - (lastDigit * 9)) % 13 === 0) {
  9. return isDivisibleBy13(remainingDigits);
  10. }
  11. return false;
  12. };
Add Comment
Please, Sign In to add comment