Problem 53740. Easy Sequences 59: Almost Twin Primes
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 commentsGroup

Easy Sequences Volume VII
- 10 Problems
- 3 Finishers
- Easy Sequences 50: Blocked Gaussian Integers
- Easy Sequences 51: Positive Gaussian Primes
- Easy Sequences 52: Non-squarable Rectangles
- Easy Sequences 53: Greatest Proper Divisor
- Easy Sequences 54: Product of Products of Proper Divisors
- Easy Sequences 55: "Ugly" Rectangles?
- Easy Sequences 56: Counting "Ugly" Numbers
- Easy Sequences 57: "Pretty-gorean" Triangles?
- Easy Sequences 59: Almost Twin Primes
- Easy Sequences 60: Almost Cube Root
Problem Recent Solvers3
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!