-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_1.cpp
More file actions
29 lines (26 loc) · 851 Bytes
/
test_1.cpp
File metadata and controls
29 lines (26 loc) · 851 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
import time
def intersection_equations():
x = 1
z = 2
b = 2 ** z
y1 = x
y2 = ((3 * x) + 1) / b
start_time = time.time() # Record start time
while True:
if y2 > y1:
while y2 > y1:
z += 1
b = 2 ** z
y2 = ((3 * x) + 1) / b # Recalculate y2
else:
y1 = x
if y1 > 0 and y2 > 0 and y1 % 2 != 0 and y2 % 2 != 0 and y1 == y2:
print(f"\rIntersection: x = {int(x)}, y = {int(y1)}")
else:
print(f"\rCurrent x: {x} Speed: {x / (time.time() - start_time):.2f} updates/second", end='') # Use \r to update only x
x += 1
z = 1 # Reset z to 1
b = 2 ** z # Reset b
y2 = (3 * (y2 / 2) + 1) / b
# Call the function
intersection_equations()