A number is said to be twisted prime if it is a prime number and reverse of the number is also a prime number.
Input : 97 Output : Twisted Prime Number Explanation: 97 is a prime number and its reverse 79 is also a prime number. Input : 43 Output : Not a Twisted Prime Number Explanation: 43 is a prime number but its reverse 34 is not a prime number.
The idea is first check if n is a prime number then reverse the number n and check reversed n is a prime number or not.
First few Twisted Prime Numbers are :- 2 3 5 7 11 13 17 31 37 71 73 79 97 101 107 113 131 149 151 157 167 179 181 191 199
This article is contributed by Nikita Tiwari. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Count occurrences of a prime number in the prime factorization of every element from the given range
- Print the nearest prime number formed by adding prime numbers to N
- Check if a number is Prime, Semi-Prime or Composite for very large numbers
- Check if a prime number can be expressed as sum of two Prime Numbers
- Find coordinates of a prime number in a Prime Spiral
- Number of factors of very large number N modulo M where M is any prime number
- Find the minimum number to be added to N to make it a prime number
- Number which has the maximum number of distinct prime factors in the range M to N
- Count of prime digits of a Number which divides the number
- Check if a number is divisible by all prime divisors of another number
- Represent a number as a sum of maximum possible number of Prime Numbers
- Check if the number is a Prime power number
- Largest number less than N whose each digit is prime number
- Number with maximum number of prime factors
- Find third number such that sum of all three number becomes prime
- Prime number in PL/SQL
- Given a number x , find y such that x*y + 1 is not a prime
- Kth prime number greater than N
- Additive Prime Number
- Sum of every K’th prime number in an array