An emirp (prime spelled backward) is a prime number that results in a different prime when its digits are reversed. Note that this definition excludes palindromic numbers from being emirps. The number 13, for example, is an emirp because the number with the same digits in reverse order (31) is also a prime number. The number 23 is not an emirp, notwithstanding the fact that it is a prime number, since the number with the same digits in reverse order (32) is not a prime. Despite the fact that 101 is a prime number, it is not an emirp because it is a palindrome.
Write a function reversed_number that takes a positive integer (int). The function must return an integer (int) that is composed of the same digits as the given integer, but in reverse order. As such, when given the integer 1234 the function must return the reverse number 4321. Any leading zeros in the reverse number must be ignored, so that the reverse number of 1200 is 21.
Write a function isprime that takes a positive integer (int). The function must return a Boolean value (int) that indicates whether the given integer is prime.
Use the functions reversed_number and isprime to write a function isemirp that takes a positive integer (int). The function must return a Boolean value (bool) that indicates whether the given integer is an emirp.
>>> reversed_number(123)
321
>>> isprime(2)
True
>>> isprime(32)
False
>>> isprime(31)
True
>>> isemirp(13)
True
>>> isemirp(23)
False
>>> isemirp(101)
False