Problem 42415. Divisible by 13
Write a function to determine if a number is divisible by 13. Similar to the number seven, this can be done by a few different methods:
- Form the alternating sum of blocks of three (separated at the comma locations). Apply this recursively until a three-digit number remains. If this number is divisible by 13, then so is the original number. This three-digit number can also be further reduced using one of the other methods below.
- Add four times the last digit to the remaining number. Apply recursively until a two-digit number remains. As before, if this number is divisible by 13, then so is the original number.
- Similar to the previous method, multiply the last digit by nine and subtract it from the remaining number. Apply recursion, etc.
Some of the function restrictions have been lifted.
Previous problem: divisible by 12. Next problem: divisible by 14.
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers147
Suggested Problems
-
Project Euler: Problem 4, Palindromic numbers
1077 Solvers
-
Number of 1s in a binary string
9227 Solvers
-
Natural numbers in string form
1529 Solvers
-
Flip the vector from right to left
9085 Solvers
-
Given a square and a circle, please decide whether the square covers more area.
1055 Solvers
More from this Author139
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!