fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. int main()
  6. {
  7. int x = 27;
  8. for(unsigned int i=0; i < 10; ++i)
  9. {
  10. std::cout << i << " : " << i*1000000000 << " : " << x << std::endl;
  11. if(x==1) break;
  12. x = x%2 ? x*3+1 : x/2;
  13. }
  14. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
0 : 0 : 27
1 : 1000000000 : 82
2 : 2000000000 : 41
3 : 3000000000 : 124
4 : 4000000000 : 62
5 : 705032704 : 31
6 : 1705032704 : 94
7 : 2705032704 : 47
8 : 3705032704 : 142
9 : 410065408 : 71