The Emirp Sentinel

MediumAcc. 86.1%
+30 XP 12

Primes in the Mirror

An Emirp (prime spelled backwards) is a prime number that results in a different prime number when its digits are reversed. Example: 13 (prime) $ o$ 31 (prime). (Note: Palindromic primes like 11 are NOT emirps).

The Assignment

Your function receives a parameter target.

  1. Check if target is a prime number.
  2. Calculate the reverse of target mathematically.
  3. Check if the reverse is also a prime number.
  4. Check if the reverse is not equal to the original target.
  5. Print "true" if all conditions are met, otherwise "false".

01EXAMPLE 1

Inputtarget = 13
Outputtrue

Explanation: 13 and 31 are different primes.

Constraints

  • Use loops for primality and reversal.
  • Explicitly exclude palindromes.
MathLoopsLogic
JavaScript
Loading...
3 Hidden

Input Arguments

target13

Expected Output

true

Click RUN to test your solution