Advertisement
Guest User

casting nines

a guest
Jul 11th, 2022
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 13.53 KB | None | 0 0
  1. "calculating...")
  2. while j < len(primes):
  3.   k = j
  4.   while k < len(primes):
  5.     #use the smallest of the two
  6.     p = a*b
  7.     if a < b or a == b:
  8.       i = d(floor(a/2))
  9.       r = (p-(((abs(((((p)-(9**i)-9)+1))-((((9**i)-(p)-9)-2)))-p+1)-p)%p))%a
  10.     else:
  11.       i = d(floor(b/2))
  12.       r = (p-(((abs(((((p)-(9**i)-9)+1))-((((9**i)-(p)-9)-2)))-p+1)-p)%p))%b
  13.    
  14.     if r == 0:
  15.       success = success+1
  16.     else:
  17.       fail = fail+1
  18.       results.append([a, b])
  19.    
  20.    
  21.     k = k + 1
  22.     count = count + 1 #keep a running total of all iterations
  23.     print(f"success: {success}, fail: {fail}, success-to-failure ratio: {success/fail}")
  24.     if k < len(primes):
  25.       a = primes[k]
  26.     else:
  27.       pass
  28.   j = j + 1
  29.   if j < len(primes):
  30.     b = primes[j]
  31.   else:
  32.     pass
  33.  
  34. print("done!")
  35. print(" - final results -")
  36. print(f"success: {success}, fail: {fail}, success-to-failure ratio: {success/fail}")
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement