Problem statement
The twin prime couples (p,p') are the ones such that p' = p + 2.
For a given integer n > 1, list the twin prime couples less or equal to n.
Present your result in a m x 2 matrix, where m is the number of twin couples.
Examples
- n = 10 => p = [3, 5; 5, 7];
- n = 20 => p = [3, 5; 5, 7; 11, 13; 17 19];
- n = 100 => p = [3, 5; 5, 7; 11, 13; 17 19; 29, 31; 41, 43; 59, 61; 71, 73];
Forbidden functions / expressions
- regexp
- assignin
- str2num
- echo
See also
Solution Stats
Problem Comments
Solution Comments
Show comments
Loading...
Group
Problem Recent Solvers41
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!