I created a script to find a number inside pi:
from math import pi from mpmath import mp from time import sleep as sleep def loop(find): #Breaks the find string into a list findList = [] print('Finding ' + str(find)) num = 1000 while True: mp.dps = num string = str(mp.pi) result = string.find(str(find)) if result == -1: print("Couldn't find " + str(find) + " within the first " + str(num) + " of Pi. Looking moving into the first " + str(num * 10) + " digits instead") num = num * 10 continue pass else: print(str(find )+ ' was found at character: ' + str(result)) break pass pass def main(): find = input("What do you want to find: ") find = int(find) character = loop(find) if True: main() input = () When a long number is inputed it takes a long time to process for obvious reasons. I'm running an Intel i5-9300h and a GTX 1650. I am wondering if 1) I can make this code run on my GPU instead of my CPU 2) If so, how do I do this? 3) Would it even benefit performance?
Any help is much appreciated.