Given a vector a, which will always contain at least one pair of prime numbers couple, return a matrix called 'couple' in which each row contains one pair of prime couples. A prime number couple pair are two prime numbers with a difference of two between them. Keep in mind that the numbers 2, 3, 5, and 7 are prime numbers.
For example, if a=[1 2 3 6 11 13 101 103], the output should be couple=[11 13; 101 103].
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers28
Suggested Problems
-
Given an unsigned integer x, find the largest y by rearranging the bits in x
2055 Solvers
-
290 Solvers
-
Project Euler: Problem 9, Pythagorean numbers
1398 Solvers
-
How many monitors are connected ?
159 Solvers
-
Sum the elements in either diagonal of a square matrix
222 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Is there any particular reason why "1" should be a prime number? Since none of exampe in test suite pointing us to that direction. besides, I fail to figure out the necessity of that either.
Mathematically speaking, 1 is not a prime number. Primes are defined as number greater than 1. Also, the difference between 2 and 1 isn't two, so I don't see why [1 2] would be a valid output anyway.
James and bainhome, I apologise for making the two errors that you pointed out. I have corrected them and updated the problem.