Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- Copyright (c) 2023 Zeromega
- Drop a link or a Sub on one of my videos if this script help you, copy the link below
- https://www.youtube.com/channel/UCfqUJ4rmk6W-ZAjDtkBZ1CA?sub_confirmation=1
- """
- from mpmath import mp
- precision = 10000000
- target_sequence = "9999999"
- search_range = 1000000
- mp.dps = precision
- pi = mp.pi
- pi_str = str(pi)
- for i in range(len(pi_str) - len(target_sequence) + 1):
- if pi_str[i:i + len(target_sequence)] == target_sequence:
- print(f"Target sequence found at position {i + 1} to {i + len(target_sequence)}: {pi_str[i:i + len(target_sequence)]}")
- break
- consecutive_found = False
- consecutive_count = 1
- for i in range(1, search_range):
- if pi_str[i] == pi_str[i - 1]:
- consecutive_count += 1
- if consecutive_count == len(target_sequence):
- consecutive_found = True
- print(f"Consecutive sequence of length {len(target_sequence)} found at position {i - len(target_sequence) + 2} to {i + 1}: {pi_str[i - len(target_sequence) + 1:i + 1]}")
- break
- else:
- consecutive_count = 1
- print(f"Searching at position {i + 1}...")
- if not consecutive_found:
- print("No consecutive sequence found.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement