按照你的方法,我的程序,结果还是3121
#include "stdafx.h"
#include <iostream.h>
bool b=true;
int value;
int fen(int f)
{
int ff=f*5+1;
if((ff%4)==0)
b=true;
else b=false;
int fff=ff/4;
value=ff;
return fff;
}
int main(int argc, char* argv[])
{
int i;//i is the initial value which be devided by 5 at the fifith time.
for(i=1;;i++)
{
int ii=i;
int s;
for(s=0;s<5;s++)
{
ii=fen(ii);
if(b!=true)
break;
}
if(s==4) break;//it is OK that the program can be executed to s=4.
}
cout<<"this number is"<<value<<endl;
return 0;
}