A positive integer pair
, is called an "almost twin prime pair", if one of the pair is a prime and the other is either a prime or a semiprime. A semiprime is a natural number that is a product of only two and exactly two (not necessarily distinct) prime numbers (e.g. 4, 6, 9,
,
,
,
,
,
...).
Listed below are all almost twin prime pairs with no element greater than
:
Our task in this exercise is, to create a function that counts the number of almost twin prime pairs whose elements are less than or equal to a given limit
Therefore for
, our function should return
.
Solution Stats
Problem Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers3
Suggested Problems
-
Find all elements less than 0 or greater than 10 and replace them with NaN
15777 Solvers
-
Project Euler: Problem 9, Pythagorean numbers
1385 Solvers
-
Finding neighbors of [-1:1] in a matrix....
84 Solvers
-
Sum of odd numbers in a matrix
614 Solvers
-
Cumulative maximum of an array
41 Solvers
More from this Author116
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!