Problem 44343. Pair Primes
Let's define pair primes as follow;
- 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:
1-) 1637 and 7549 are pair primes. First ends with 7 and second starts with 7.
2-) 6221 and 2113 are pair primes. First ends with 21 and second starts with 21.
3-) 1429 and 4297 are pair primes. First ends with 429 and second starts with 429. You should be careful. 2111 and 1117 are also four digit pair primes. It satisfies three conditions. First ends with 1 and second starts with 1. First ends with 11 and second starts with 11. First ends with 111 and second starts with 111. [2111 1117] pair should be counted for once.
Given the digit counts, can you determine how many unique pair primes are there (a~=b)
Solution Stats
Problem Comments
-
5 Comments
Show
2 older comments
Mehmet OZC
on 24 Oct 2017
Thanks for pointing it out. They are different pair primes.
Rafael S.T. Vieira
on 9 Jul 2020
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.
Brandon
on 29 Jun 2023
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
-
4543 Solvers
-
The Goldbach Conjecture, Part 2
2366 Solvers
-
4507 Solvers
-
Numbers spiral diagonals (Part 2)
154 Solvers
-
413 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!