Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hachreak/factorize-numbers

Implementation of three different algorithms to factorize prime numbers: my algorithm, Pollard-Rho algorithm, Brent algorithm (Pollard-Rho optimization).
https://github.com/hachreak/factorize-numbers

Last synced: about 7 hours ago
JSON representation

Implementation of three different algorithms to factorize prime numbers: my algorithm, Pollard-Rho algorithm, Brent algorithm (Pollard-Rho optimization).

Awesome Lists containing this project

README

        

/**
* Copyright (C) 2014 Leonardo Rossi
*
* This source code is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This source code is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this source code; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/

Implementation of three different algorithms to factorize prime numbers:
- first algorithm
- Pollard-Rho algorithm
- Brent algorithm (Pollard-Rho optimization)
The web interface is used to contact the .cgi and ask to factorize number.
Enjoy it... ;)

Note: First algorithm is quick if the number of digits is not high.

Otherwise, the other two algorithms should be faster, because are based on Floyd's
cycle-finding algorithm and on the observation that (as in the birthday problem)
two numbers x and y are congruent modulo p with probability 0.5 after
1.177(sqrt{p}) numbers have been randomly chosen.