Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Okay, let's do some simplification:
- - assume a = 2*n + 1, since a is a prime number and all primes except for 2 are odd numbers
- - then floor(a/2) = n
- - assume b >= a, therefore b >= 2*n + 1
- Substitute values accordingly:
- r = (1 - b - 2*b*n + abs(3 - 2*9^n + 2*b + 4*b*n))%(2*n+1)
- Now, there are two options for abs(3 - 2*9^n + 2*b + 4*b*n)
- abs <= 0: r = (-2 + 2*9^n - 3*b - 6*b*n) % (2*n + 1)
- abs > 0: r = (4 - 2*9^n + b + 2*b*n) % (2*n + 1)
- Rearrange that, and you get
- abs <= 0: r = (2/3*3^(2*n + 1) - (2*n + 1)*b - 2) % (2*n + 1)
- abs > 0: r = (4 - 2/3*3^(2*n+1) + b*(2*n+1)) % (2*n + 1)
- Remember that a = 2*n + 1:
- abs <= 0: r = (2/3*3^a - a*b - 2) % a
- abs > 0: r = (4 - 2/3*3^a + a*b) % a
- (a*b)%a is always 0, so
- abs <= 0: r = ((2*3^a)/3 - 2) % a
- abs > 0: r = (4 - (2*3^a)/3) % a
- Let's also insert initial condition:
- when b > (2*3^a - 9)/(6*a): r = (4 - (2*3^a)/3) % a
- otherwise: r = ((2*3^a)/3 - 2) % a
- Here's a modified paste: https://pastebin.com/42uW6kEZ
- 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).
- You'll also get an error whenever a = 3, because ((2*3^3)/3 - 2) % 3 == 1.
- 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