Conditions for Pollard's rho algorithm for logarithms I am trying to implement Pollard's rho algorithm for logarithms, but it looks like I am missing some initial condition which has to be met, because in my case it never works.
Example:
$203^{\text{7}}=27\space(mod\space229)$
I am using algorithm from Wikipedia article.
In my case:
$n=19$ (order of group with generator $203$)
$N=229$ (prime)
$alpha=203$
$beta=27$
iteration             x     a       b                 X     A       B
    0                 1     0       0                 1     0       0
    1               203     1       0               214     1       1
    2               214     1       1               225     2       2
    3               161     2       1                42     5       4
    4               225     2       2               225     10      9

$r=b-B=-7=222\space(mod\space229)$
$r^{\text{-1}}=98\space(mod\space229)$
$x=r^{\text{-1}}(A-a)=98 * 8\space(mod\space229)=97\space(mod\space229)$
But $203^{\text{97}}=218\space(mod\space229)$
 A: You didn't follow the algorithm from WP to the end. When working with the logarithms you need to switch from modulo $p$ to modulo $p-1$. What I mean by "logarithms" here is the stuff in the exponents.

Your run of the algorithm shows that with $\alpha=203$,
$\beta=27$ we have
$$\alpha^2\beta^2\equiv \alpha^{10}\beta^9,$$
or
$$
\alpha^{10-2}\beta^{9-2}=\alpha^8\beta^7\equiv1.
$$
Assuming that $\beta=\alpha^x$ this comes to
$$\alpha^8\cdot\alpha^{7x}=\alpha^{8+7x}\equiv1.\qquad(*)$$
So far all the congruences have been modulo $p=229$. Next that will change.
By Little Fermat $\alpha^n\equiv1$ whenever $228\mid n$, so $(*)$ will be true whenever
the congruence
$$
8+7x\equiv0\pmod{228}\qquad(**)
$$
holds.
Modulo $228$ we have $(-7)^{-1}\equiv 65$. Therefore $65\cdot8\equiv64\pmod{228}$ is a solution of $(**)$.
As you observed, here already $\alpha^{19}=1$. Therefore we can reduce this modulo $19$, and arrive at $64\equiv7\pmod{19}$.

When running Pollard rho it may well happen that the difference $b-B$ has a common factor with $p-1$. In that case $(b-B)$ has no modular inverse, and the congruence you got only yields partial information about the discrete logarithm. You can either continue to find more collisions, or use the partial information in some other approach (BS/GS, CRT-based, whatnot).
