Problem 44343. Pair Primes
- For 2 digits numbers: 11 and 17 are pair primes because both of them are 2 digits prime numbers and last digit of the first prime equals to the first digit of second prime number. 11 and 11 are not pair primes because a = b.
- For 3 digit numbers: 389 and 967 are pair primes because both of them are 3 digits prime numbers and last digit of the first prime equals to the first digit of the second prime number (797 and 797 are not pair primes because a = b). 467 and 673 are pair primes too because the last two digits of the first prime number (67) equals to the first two digit (67) of the second prime number. 211 and 113 are pair primes too but they satisfy two conditions: last digit of the first prime equals to the first digit of the second prime also last two digits of the first prime equals to the first two digits of the first prime.
- For 4 digit numbers:
Solution Stats
Problem Comments
-
5 Comments
Thanks for pointing it out. They are different pair primes.
Good problem. At first, I thought we needed to reverse the numbers, but only their order is necessary. And we need to count twice numbers like 31 and 13.
Why ban elseif for this problem? I need a test for x==2, x==3, x==4, and x==5. But if one test is true, I do not want the rest to execute. The best way to do this is with elseif.
So I hacked the answer to spite it all.
Solution Comments
Show commentsProblem Recent Solvers103
Suggested Problems
-
Renaming a field in a structure array
1549 Solvers
-
Project Euler: Problem 3, Largest prime factor
1598 Solvers
-
Back to basics 23 - Triangular matrix
1035 Solvers
-
9492 Solvers
-
We love vectorized solutions. Problem 1 : remove the row average.
832 Solvers
More from this Author92
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!