{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

hwsol1.5

# hwsol1.5 - CSci 5403 Spring 2010 Homework 1.5 Sample...

This preview shows pages 1–2. Sign up to view the full content.

CSci 5403, Spring 2010 Homework 1.5 Sample Solution Ruoyu Sun 1. Question 5 (a) Prove that given a polynomial-time decision algorithm for fact we can design a polynomial-time factoring algorithm. Suppose Pfact is a polynomial-time decision algorithm for FACT. Given an integer N . We describe a polynomial-time algorithm to re- cover all of its prime factors. 1. Use binary search to find p 1 , which is the largest proper prime factor of N .(A proper factor of N is a factor of N that is not equal to N ). Such p 1 does not exist iff N is a prime. Note that h N, k i ∈ FACT N has a proper prime factor p k p 1 k . Call Pfact to determine whether h N, d N/ 2 ei ∈ FACT , i.e. whether d N/ 2 e ≤ p 1 < N . If d N/ 2 e ≤ p 1 < N , call Pfact ( h N, d 3 N/ 4 ei ) to determine whether d N/ 2 e ≤ p 1 < d 3 N/ 4 e or d 3 N/ 4 e ≤ p 1 < N ; else (1 p 1 < d N/ 2 e or p 1 does not exist), call Pfact ( h N, d N/ 4 ei ) to determine whether d N/ 4 e ≤ p 1 < d N/ 2 e . Continue doing so until we can determine the largest proper prime factor p 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}