-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcc.cpp
More file actions
57 lines (38 loc) · 993 Bytes
/
cc.cpp
File metadata and controls
57 lines (38 loc) · 993 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <iostream>
#include <string>
using std::cout, std::cin, std::string, std::endl;
unsigned long long cc(unsigned long long seed) {
unsigned long long highscore = 0;
unsigned long long carrier = seed;
while (true) {
if (carrier == 4) {
cout << "Conjecture true for seed " << seed << "\n";
break;
}
if (carrier % 2 == 0) {
carrier /= 2;
}
if (carrier % 2 != 0) {
carrier = carrier * 3 + 1;
}
if (highscore < carrier) {
highscore = carrier;
}
}
return highscore;
}
int main() {
start:
cout << "Please enter a seed (long long): ";
unsigned long long userseed = 0;
cin >> userseed;
userseed = cc(userseed);
cout << "\nFinal peak: " << userseed << "\n\n";
cout << "Repeat the process with a new seed? Yes or No." << endl;
string response;
cin >> response;
if (response == "y" || response == "Y" || response == "yes" || response == "Yes") {
goto start;
}
return 0;
}