Find prime number couples - MATLAB Cody - MATLAB Central

Problem 44675. Find prime number couples

Difficulty:Rate

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

50.94% Correct | 49.06% Incorrect
Last Solution submitted on Apr 23, 2024

Problem Comments

Solution Comments

Show comments
Primes and Rough Numbers, Basic ideas
What is a rough number? What can they be used...
2
4

Problem Recent Solvers24

Suggested Problems

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Go to top of page