Natasha K. answered 05/19/23
Experienced math and chess educator for all ages
The short answer to your question is no, and that's the mathematical basis of the Diffie-Hellman key exchange (https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange) encryption algorithm. If the numbers you choose are sufficiently small then you can write a computer program to do this by brute force - not an elegant mathematical solution.