I have the equotation
$$(x-g)\mod(2g)=0,\; x \in \Bbb N, n \in \Bbb N$$
I need a formula to calculate $g$ out of a given $x$, I tried WolframAlpha, but I only get pairs of numbers matching this equotation.
I heard of the inverse modulo operator, but I'm not sure if or how this operate could help me here.
Since I'm not a mathematician you can hopefully forgive me, if this is a stupid question.
Any help is appreciated.
EDIT: Some Testcases:
for $x=[1,3,5,7,9,11],\; g=1$,
for $x=[2,6,10,14,18,22],\; g=2$,
for $x=[4,12,20,28,36,44],\; g=3$,
for $x=[8,24,40,56,72,88],\; g=4$,
You want that $x-g=2gn$, where $n$ is some integer, which means $$ g=\frac{x}{2n+1} $$ So, take any odd divisor of $x$ and you'll find a value for $g$, two if you allow negative values for $g$.
For instance, if $x=1$, you only have the solutions $g=1$ or $g=-1$. For $x=3$ you can take $g=3/1=3$ or $g=3/3=1$ (or their negatives). For $x=6$, the possible values are $g=6/1=6$ or $g=6/3=2$ (plus $-6$ or $-2$).
If $x=2^k$, with $k>0$, only $g=1$ is possible.
The solution $g=4$ for $x=8$ is not good: inded $8-4\not\equiv0\pmod{2\cdot4}$.