Giter Club home page Giter Club logo

quadsieve's Introduction

QuadSieve

by Thomas Panetti & Noemi Glaeser 04/28/16 CSCE 557

About: This program is an implementation of the Multi-Precise Quadratic Sieve algorithm.

use: To compile this program, simply use the javac compiler javac QuadraticSieve.java To run this file, run the class file with the input java QuadraticSieve [N] [Factorbase] EX: java QuadraticSieve 1037 100 or simply run it and it will prompt you for input java QuadraticSieve

How: First, this program generates a list of primes (including -1) up to the size of the factorbase using Eratosthenes sieve. For example, for a factorbase of 10 the primes list would be {-1, 2, 3, 5, 7}. Next, the program populates an array from index -R to R, R being sqrt(N), with the values (R+n)^2 - N, n being the current index in -R to R. Next, we run a loop through every prime in the prime array and attempt to divide each value in the array from -R to R by the prime. This is repeated with every prime in the factorbase.

Now we are left with an array of residuals after the division
by every prime in the factorbase. Indices at which the residual
is equal to one represent numbers that are smooth over the 
factorbase. We rebuild the prime factorization of the smooth numbers 
using trial division, giving us a matrix with rows representing the
individual smooth numbers (whose original indices are stored in a pair),
and with columns representing the primes in the factorbase. Each entry
stores the exponents of the prime factors of that particular smooth 
number. We then reduce the matrix mod 2. 

Lastly, we use Gauss-Jordan elimination to determine the combinations
of rows (the rows represent values of n in the original array from -R
to R) that sum to zero. For each combination, we rebuild the equation 
(x^2 = y^2), where x^2 is the product of (R+n)^2 -N for each n in the 
combination, and y^2 is the product of (R+n)^2 for each n in the 
combination. Taking the gcd of N and x-y and of big N and x+y, we 
(ideally) obtain two factors of N. By repeating this process with
every combination obtained from Gauss-Jordan elimination, we try to get
every possible factor of N. Finally, we do the division of every factor 
by every other factor to make sure we have both factors of each composite 
factor found.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.