Command to find the pre-image of a set that is mapped to by the function $f(x)=3^x \mod{17}$

$$f(x)=3^x \mod{17}$$

How to find the pre-image of the set if this function maps from real numbers to real numbers. What command would I use, to see the pre-image if the function would map from integers to integers.

It is easy to compute with mathematica, but the command to find the pre-image I cannot find.

What I tried, and there are no methods available to solve it:

Solve[y == 3^x - 17 Floor[3^x/17], x]


Output:

• Not sure why you'd want the pre-image for the reals. For integers, it's a discrete logarithm using MultiplicativeOrder like this: pri = Table[MultiplicativeOrder[3, 17, i], {i, 17 - 1}] and you can verify with Table[Mod[3^y, 17], {y, pri}] May 8 at 16:42
• You might also look at PowerMod e.g. PowerMod[3, x, 17] May 8 at 16:44
• Ok, but how to get it back, if I only know the function and the image for example.
– VLC
May 8 at 16:51
• Partial success: domain = -1 < u < 60; range = 3 < y < 5; Reduce[y == PiecewiseExpand[Mod[u, 17], domain] && domain && range /. u -> 3^x, {x}, {y}, Reals]. Let someone else take it from here. May 8 at 18:29