Cody

# Problem 42455. Divisible by n, prime divisors - 11, 13, 17, & 19

Divisibility checks against prime numbers can all be accomplished with the same routine, applied recursively, consisting of add or subtract x times the last digit to or from the remaining number. For example, for 13, add four times the last digit to the rest:

• 2392: 239 + 4*2 = 247: 24 + 4*7 = 52: 5 + 4*2 = 13 -> 2392 is divisible by 13.

For 17, subtract five times the last digit from the rest:

• 3281: 328 - 5*1 = 323: 32 - 5*3 = 17 -> 3281 is divisible by 17.

For 19, add two times the last digit to the rest:

• 16863: 1686 + 2*3 = 1692: 169 + 2*2 = 173: 17 + 2*3 = 23: 2 + 2*3 = 8 -> 16863 is not divisible by 19.

And, for 11, subtract the last digit from the rest:

• 269830: 26983 - 0 = 26983: 2698 - 3 = 2695: 269 - 5 = 264: 26 - 4 = 22: 2 - 2 = 0 -> 269830 is divisible by 11.

Write a function to return a true-false vector for the prime numbers in the 11:20 range ([11 13 17 19]) based on a number supplied as a string.

Restrictions on Java, mod, ceil, round, and floor are still in effect.

Previous problem: Divisible by n, prime divisors (including powers). Next problem: Divisible by n, prime divisors from 20 to 200.

### Solution Stats

45.74% Correct | 54.26% Incorrect
Last Solution submitted on Mar 30, 2020