/*
==================================================================
Title: The reversible Prime is a number is a prime, reverse order or prime, such as ABC is prime, CBA is also prime.
==================================================================
*/
#include <stdio.h>
int Sushu (int n)
{
int i,k;
if (n%2==0)
return 0;
Else
{
K=int (N/2);
for (i=3;i<=k;i++)
{
if (n%i==0) return 0;
else return 1;
}
}
}
Main ()
{
int m,n,k=0;
int Ge,shi,bai,qian;
for (m=1000;m<10000;m++)
if (Sushu (m))
{
ge=m%10;
shi=m/10%10;
bai=m/100%10;
qian=m/1000;
N=ge*1000+shi*100+bai*10+qian;
if (Sushu (n))
{
printf ("%5d", m);
k++;
if (k%10==0)
printf ("\ n");
}
}
}
/*
==================================================================
Comment: Because the scope is relatively small (1000-10000), so the most direct method (intuitive) to seek, when the number
Larger time should be used two functions: 1 is to determine the number of prime functions, 2 is to find the reverse function, the reader can try to complete their own.
==================================================================
*/
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Basic algorithm of C language 21-reversible prime number