Problem 44675. Find prime number couples

Created by Jafar Mortadha in Community

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

60.0% Correct | 40.0% Incorrect
Last solution submitted on Jul 17, 2018

Problem Comments

Recent Solvers10

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!