例如,人们认为,回文数中存在无穷多个素数11,101,131,151,191……。除了11以外,所有回文素数的位数都是奇数。道理很简单:如果一个回文素数的位数是偶数,则它的奇数位上的数字和与偶数位上的数字和必然相等;根据数的整除性理论,容易判断这样的数肯定能被11整除,所以它就不可能是素数。
人们借助电子计算机发现,在完全平方数、完全立方数中的回文数,其比例要比一般自然数中回文数所占的比例大得多。例如11^2=121,22^2=484,7^3=343,11^3=1331,11^4=14641……都是回文数。
人们迄今未能找到自然数(除0和1)的五次方,以及更高次幂的回文数。于是数学家们猜想:不存在n^k(n≥2,k≥5;n、k均是自然数)形式的回文数。
#include <stdio.h>
#include <stdlib.h>
#include<string.h>
int k(int n);
int main()
{
int n;
scanf("%d",&n);
int m=0;
while(m=k(n),m!= n)
{
printf("%d ",n); //输出n;
n=n+m; //把n更新为 m + n;
}
printf("%d",n);
return 0;
}
int k(int n)
{
int temp=0;
while(n>0)
{
temp=temp*10+n%10;
n=n/10;
}
return temp;
}