Advertisement
Guest User

Untitled

a guest
Jul 12th, 2022
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. Okay, let's do some simplification:
  2.  
  3. - assume a = 2*n + 1, since a is a prime number and all primes except for 2 are odd numbers
  4. - then floor(a/2) = n
  5. - assume b >= a, therefore b >= 2*n + 1
  6.  
  7. Substitute values accordingly:
  8.  
  9. r = (1 - b - 2*b*n + abs(3 - 2*9^n + 2*b + 4*b*n))%(2*n+1)
  10.  
  11. Now, there are two options for abs(3 - 2*9^n + 2*b + 4*b*n)
  12.  
  13. abs <= 0: r = (-2 + 2*9^n - 3*b - 6*b*n) % (2*n + 1)
  14. abs > 0: r = (4 - 2*9^n + b + 2*b*n) % (2*n + 1)
  15.  
  16. Rearrange that, and you get
  17.  
  18. abs <= 0: r = (2/3*3^(2*n + 1) - (2*n + 1)*b - 2) % (2*n + 1)
  19. abs > 0: r = (4 - 2/3*3^(2*n+1) + b*(2*n+1)) % (2*n + 1)
  20.  
  21. Remember that a = 2*n + 1:
  22.  
  23. abs <= 0: r = (2/3*3^a - a*b - 2) % a
  24. abs > 0: r = (4 - 2/3*3^a + a*b) % a
  25.  
  26. (a*b)%a is always 0, so
  27.  
  28. abs <= 0: r = ((2*3^a)/3 - 2) % a
  29. abs > 0: r = (4 - (2*3^a)/3) % a
  30.  
  31. Let's also insert initial condition:
  32.  
  33. when b > (2*3^a - 9)/(6*a): r = (4 - (2*3^a)/3) % a
  34. otherwise: r = ((2*3^a)/3 - 2) % a
  35.  
  36. Here's a modified paste: https://pastebin.com/42uW6kEZ
  37.  
  38. Now, if you look closely, (4 - (2*3^a)/3) % a == 0 only holds when a = 1 or a = 2, so you'll always get an error if b > (2*3^a - 9)/(6*a).
  39.  
  40. You'll also get an error whenever a = 3, because ((2*3^3)/3 - 2) % 3 == 1.
  41.  
  42. For all other cases you have ((2*3^a)/3 - 2) % a == 0, which I believe could be proven in a similar way as the RSA encryption algorithm.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement