示例#1
0
int main()
{
  long int longest=1,start_number=1,i;
  for(i=1; i<=1000000; i++)
    {
      if (Collatz(i)>longest)
        {
          longest = Collatz(i);
          start_number = i;
        }
    }
  printf("the longest chain started number: %ld\n",start_number);
  return 0;
}
示例#2
0
int main()
{
    long long int i, max_value=0, max_number=0;
    
    /** LIMIT alatti leghosszabb Collatz-sorozat hossza */
    for (i=1; i<LIMIT; ++i)
    {
        if (Collatz(i)>max_value)
        {
            max_value=Collatz(i);
            max_number = i;
        }
    }
    printf("%llu adja leghosszabb, %llu hosszu sorozatot.\n",max_number, max_value);
    return 0;
}