Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int n = 1000000;
- long rod;
- long startTala = 0;
- long radarLengd = 0;
- for(int i = 2; i <= n; i++){
- int length = 1;
- rod = i;
- while(rod!= 1) {
- if((rod % 2) == 0){
- rod = rod / 2;
- } else {
- rod = (rod * 3)+1;
- }
- length++;
- }
- if (length > radarLengd) {
- radarLengd = length;
- startTala = i;
- cout <<i<< endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement