In this video, Dr Barker argued that a set of 10 consecutive integers must have at least one integer coprime to the rest. For example, in the set 20:29, both 23 and 29 are coprime to the other elements of the set.
The argument proceeds like this: In a set of 10 consecutive integers, five are even, and five are odd. The even numbers are not coprime because they share a factor of 2 (at least). Of the five odd numbers, at most two will be divisible by 3, one will be divisible by 5, and one will be divisible by 7. Aside from 1, the remaining number will not be divisible by any number less than 10, and if the remaining number is divisible by a number greater than 10, there cannot be another number in the set divisible by the same number. Therefore, at least one of the numbers in the set is coprime to the others.
Write a function that takes the smallest number in the set and produces the smallest number coprime to the others as well as the number of coprime integers. If the input is 20, then the function should return 23 and 2.
Solution Stats
Problem Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers6
Suggested Problems
-
2009 Solvers
-
Find state names that start with the letter N
1431 Solvers
-
Sum all integers from 1 to 2^n
17392 Solvers
-
514 Solvers
-
Set the array elements whose value is 13 to 0
1435 Solvers
More from this Author321
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!