factorize the integer 2896753 by using the Quadratic Sieve method

70.2K

Verified Solution

Question

Advance Math

factorize the integer 2896753 by using the Quadratic Sievemethod

Answer & Explanation Solved by verified expert
3.6 Ratings (314 Votes)
Code Language Java import javautilScanner import javautilArrayList import javautilHashSet This program will run a quadratic sieve to factor some numbers public class QuadraticSieve This is the range the matrix runs on 50000 works great because it works for all numbers in the range of long without being too large private static final long SIEVERANGE 50000 This is a private class to be used as a touple for saving an ArrayList and its integer index and some other things private static class Pair private final X x private final Y y public PairX x Y y thisx x thisy y public X getX return x public Y getY return y public static void mainString args Grab number N to be factored long n Grab the factor base long factorbase take from command line if no factobase is given assume 1000 ifargslength 1 n LongparseLongargs0 factorbase 1000 else ifargslength 2 n LongparseLongargs0 factorbase LongparseLongargs1 else take from scanner else Scanner input new ScannerSystemin SystemoutprintlnEnter an N n inputnextLong SystemoutprintlnEnter a factorbase factorbase inputnextLong Find R long R longMathsqrtn generate a list of primes up to factorbase ArrayList primes eratosthenesSievefactorbase forint i 0 i primessize i Systemoutprintlnprimesgeti generate a list that satisfies the eqn ArrayList bSmooth findSmoothnessn ArrayList residues calcResidualsprimes bSmooth Refactor and Gauss ArrayList refactoredResidual refactorresidues bSmooth    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students