Beginners' Guide To Factoring

This is a guide for Windows users who are interested in factoring.

(If you are using a Linux system, this is a good guide for those who use Ubuntu.)

I will introduce some softwares for factoring and also how to use them.

1. Downloads

You need to download all the software required to get started.

This is the recommended site: https://download.mersenne.ca/

Necessary programs : msieve , GGNFS , GMP-ECM , YAFU

You need to go inside the msieve , GGNFS , GMP-ECM , YAFU (version 1.34 is the most stable one) folder in this website and download the latest binaries. (Also unzip them)

Besides , you also need to download and install Python 3 (the recommended version).

Optional : CADO-NFS

If you want to use CADO-NFS , you should also download WSL2 , which provides a Linux-like environment . (Systems requirements can be found on Microsoft website)

Now the downloaded folders are : ggnfs , msieve , yafu-1.34 , gmp-ecm.

2. Preparations & Usage

I assume you have downloaded all the software mentioned above.

Create a folder called " factor " . (To me it's E:\factor.)

Extract all the downloaded files into the factor folder.

Rename the ggnfs folder "ggnfs-bin"

Copy the folder ggnfs-bin folder and rename it as " GGNFS " . They should have the same files inside.

The factor folder should look like this: (Change your folder names exactly the same if they are different from the followings)

GGNFS Preparations

Copy all the files in the msieve directory and paste them into the GGNFS folder.

The GGNFS folder should contain these files:

If you cannot find " factmsieve.py " in the downloaded GGNFS folder , you can download it here :http://gladman.me.uk/computing/factmsieve.py

Open the factmsieve.py and edit it:

Change lines 63-64 from:

to:

Change line 67 from:

to whatever the # of CPUs you want to use for the factoring.

Comment out the following lines:

Save the changes.

Now you have finished with GGNFS preparations.

GGNFS usage

To use GGNFS to factor numbers,simply create a file in the GGNFS folder called "number.n"(or whatever name you like) with the format

There must be an empty line at the end of it.

Then cd to the GGNFS directory and type

And you can enjoy factorization.

YAFU preparations

Open the yafu.ini file in the yafu-1.34 folder.

Change it to look like this and save the changes:

Finished.

YAFU usage

cd to your yafu-1.34 folder and type:

If you want to use GGNFS with YAFU(which has been filled in the ini file),type

The number can be an expression,like

or

Then yafu will factor the number itself.

The preparations and usage information ends here.

3. Optional Software

If you want to use CADO-NFS,which is much faster than GGNFS on Windows,you need to use WSL. It's maybe the fastest and easiest way to use an Linux app on Windows.

You need to install GMP first.

Open WSL and enter

Enter your password,then enter

Download GMP from https://gmplib.org/download/gmp/gmp-6.2.1.tar.xz

Rename the gmp-6.x.x folder to gmp.

Extract to the factor folder.

Move into the GMP folder in WSL.

type

If all checked out, type:

Now you have installled GMP.

 

Stay in the factor folder,enter

After it finishes,enter

to check if it works alright. Wait a few seconds,and something like this should appear

Other usage on CADO-NFS can be found in the README file.

4. Usage examples

YAFU:

GGNFS:

inside number.n:

CADO-NFS:

5. Factoring Websites

The biggest factoring website:

factordb.com

The best factoring forum:

mersenneforum.org

Use ECM online:

Integer factorization calculator

6. A Shortcut

For those who meet problems,I have uploaded my version of the factor folder to Github as zip. You can download directly from https://github.com/MDNTCT/Factoring/blob/main/factor.zip .

The only changes required are the following:

The package does not contain CADO-NFS,so you need to install it yourself.

7. Things to know

Someone made a list of time needed for factoring:

How to factor an ordinary number:

  1. Try with YAFU to find small factors first (<50 digits).
  2. If YAFU finishes factoring,it's done. If YAFU sticks on a certain step for a long time (for example if a 100 digits composite factor is left not factored and has no small factor to be found with ECM) ,you should abort YAFU and try with another software to factor it. For example GGNFS or CADO-NFS.

8. Other Information

All information on usage can be found in the README files in YAFU,CADO-NFS and GGNFS folders.

References:

https://mersenneforum.org/showthread.php?t=23078&page=3

http://mersenneforum.org/showthread.php?t=23079

https://mersenneforum.org/showthread.php?t=23089

https://gilchrist.great-site.net/jeff/factoring/nfs_beginners_guide.html