I was wondering if there was a 'smart' way to solving a congruence like: . This is a sub-problem to an overall problem but I think I'm on the right track.Things to note: there are exactly 3 solutions and all integers with ordre six satisfies the congruence (as a consequence of earlier work).

I know the solutions are but I could only come up with a brute force way of finding them:

To attain integer solutions to a, we see that:

Now it's a matter of testing values of a from 1 to 31 until k is an integer. Luckily, it doesn't take long to find a = 6 works which implies that works as well.

This is a rather inelegant way of doing it so is there a better way of doing this or would this suffice?