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:
For 17, subtract five times the last digit from the rest:
For 19, add two times the last digit to the rest:
And, for 11, subtract the last digit from the rest:
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.
Project Euler: Problem 6, Natural numbers, squares and sums.
816 Solvers
88 Solvers
Find the maximum number of decimal places in a set of numbers
182 Solvers
Relative ratio of "1" in binary number
177 Solvers
Divisible by n, Composite Divisors
34 Solvers