Pollard's rho algorithm: Difference between revisions

Content deleted Content added
TXiKiBoT (talk | contribs)
Kuroyama (talk | contribs)
/* The use of pseudo-code took an elegant idea and turned it into something difficult to penetrate. And it is redundant as Wikipedia already has a good explanation with code included.
Line 23:
 
==Richard Brent's variant==
In 1980, [[Richard Brent (scientist)|Richard Brent]] published a faster variant of the rho algorithm. He used the same core ideas as Pollard, but he used a different method of cycle detection, thatreplacing was[[Floyd's fastercycle thanfinding Floydalgorithm]] with the related [[Cycle_detection#Brent.27s_algorithm|Brent's originalcycle algorithmfinding method]].
 
Brent's algorithm is as follows:
 
'''Input''': ''n'', the integer to be factored; ''x''<sub>0</sub>, such that 0 &le; ''x''<sub>0</sub> &le; n; ''m'' such that ''m'' &gt; 0; and ''f''(''x''), a pseudo-random function modulo ''n''.
 
'''Output''': a non-trivial factor of ''n'', or failure.
# ''y'' &larr; ''x''<sub>0</sub>, ''r'' &larr; 1, ''q'' &larr; 1.
# Do:
## ''x'' &larr; ''y''
## For ''i'' = 1 To ''r'':
### ''y'' &larr; ''f''(''y'')
##''k'' &larr; 0
## Do:
### ''ys'' &larr; ''y''
### For ''i'' = 1 To min(''m'', ''r'' &minus; ''k''):
#### ''y'' &larr; ''f''(''y'')
#### ''q'' &larr; (''q'' &times; |''x'' &minus; ''y''|) mod ''n''
### ''g'' &larr; GCD(''q'', ''n'')
### ''k'' &larr; ''k'' + ''m''
## Until (''k'' &ge; ''r'' or ''g'' > 1)
## ''r'' &larr; 2''r''
# Until ''g'' > 1
# If ''g'' = ''n'' then
## Do:
### ''ys'' &larr; ''f''(''ys'')
### ''g'' &larr; GCD(|''x'' &minus; ''ys''|, ''n'')
## Until ''g'' > 1
# If ''g'' = ''n'' then return failure, else return ''g''
 
==In practice==