Home > Back-end >  Check the most magical number in the world
Check the most magical number in the world

Time:12-04

Baidu said: 142857, also known as version number, it is found in the Egyptian pyramids, it is a set of magic number, it proves that there are 7 days a week, it self accumulation time, it by the six Numbers in accordance with the order of rotation time, on the seventh day, they will have a holiday, from 999999 to generation of class, the greater the number more, each cycle of more than a week, each Numbers need to be two places at once, you don't need the computer, just know that it's member method, can know the answer to continue to accumulate, it also has more magical place waiting for you to explore!
Check code:
 int start=1234, end=9876543; 
Int n [8], [8], t, num, num2, sum;
Int I, j, k;
For (I=start; I & lt;=end; I++)
{
//decomposition
Num=0;
T=I;
While (t & gt;
=1){
N [num++]=t % 10;
T/=10;
}
//rechecking
Bool bFind=false;
For (j=0; J & lt; Num 1; J++)
{
For (k=j + 1; K & lt; Num. K++)
{
If (n==n [k] [j])
{
BFind=true;
J=num;
break;
}
}
}
If (bFind) continue;

//multiplied
Int nSame=0;
For (j=1; J & lt; Num=; J++)
{
Sum=I * j;
Num2=0;
T=sum;
While (t & gt;
=1){
M/num2 + +=t % 10;
T/=10;
}
If (num2 & gt; Num) break;

//check with
Int nFind=0;
For (k=0; K & lt; Num. K++)
{
For (int l=0; L & lt; Num. L++)
{
If (m==n [l] [k])
{
NFind++;
break;
}
}
}
If (nFind==num)
{
NSame++;
}
The else break;
}
If (nSame==num)
{
ShowMessage (IntToStr (I));
}
}
ShowMessage (" no ");

  • Related