#include <math.h>
#define SWAP(a, b, t) t = (a), (a) = (b), (b) = (t);
BOOL IsPrime(int m)
{
for (int i = 2; i <= sqrt((float)m); i++)
{
if (m % i == 0)
{
return FALSE;
}
}
return TRUE;
}
BOOL IsInversePrime(int m)
{
int x = 0, t = 0;
while(m)
{
x = m % 10;
t = t * 10 + x;
m = m / 10;
}
if (IsPrime(t))
{
return TRUE;
}
return FALSE;
}
int main()
{
for(int i = 0;i < 10000;i ++)
{
if (IsPrime(i) && IsInversePrime(i))
{
printf("%d ",i);
}
}
return 0;
}