#include "stdafx.h"
#include <iostream>
using namespace std;
void findout() {
unsigned long long c=1,c2=0,a,b,result;
for(a=1;a<1000000;a++) {
b=a;
c=1;
do {
if(b % 2 == 1) { // if b is odd (eger b tekse)
b=((b*3) + 1);
c++;
}else { // if not (degilse)
b/=2;
c++;
}
}while(b!=1);
if(c>c2) {
c2=c;
result = a;
}
}
cout << "Sonuc :" << result << " efekanpulatli.blogspot.com" << endl;
}
int main()
{
findout();
system("pause");
return 0;
}

Hiç yorum yok:
Yorum Gönder