Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/funksiya-emirp-sonlar

Is it an emirp

Medium 2000 ms 128 MB 66%
Share

Write a function IsEmirp(x) that returns true if the positive integer $x$ is an emirp and false otherwise. A prime is an emirp if writing its digits in reverse order gives a different prime.

Example 1: IsEmirp(13) → true — both $13$ and $31$ are prime.

Example 2: IsEmirp(11) → false — $11$ reads the same when reversed.

Write only the function body.

The number 13 goes into the function IsEmirp, which returns true

Input

One line with a positive integer $x$ — the argument of the function.

Output

The value returned by the function: true or false.

Note

$1 \le x \le 10^{5}$

Examples

Input #1
13
Output #1
true
Input #2
11
Output #2
false

Sign in to submit a solution

Signing up is free and takes a minute.