For example I'm given $53687$ and I'm asked to find the smallest prime such that it ends with $53687$.
Do I just need to brute force check the primality of all values that end in the given value?
I expect there's no way to get the exact answer, but is there a way to get at least an order of magnitude of the goal prime so I can skip to brute forcing on the right magnitude?
I'd hate to start brute forcing if there's a way to determine it must be greater than $10,000,000$