# Time complexity of the least common multiple (lcm) algorithm

Given two numbers a and b, the least common multiple (lcm) of a and b is the smallest number m such that both a and b are factors of m. For example, lcm(15, 21) = 105 because it is the smallest number that has both 15 and 21 as factors.

Formally, we will work with the following decision problem:

LCM = {a, b, m | lcm(a, b) = m}

(a) Explain why the following algorithm that decides LCM does not run in polynomial time:

a) Check if m is a multiple of a and b; if not reject a, b, m

b) For i = 1, 2, . . . , m − 1 do:

i. If i is a multiple of a and b, a multiple smaller than m was found.

Reject a, b, m.

c) If it reached the end of the loop without finding a multiple less than m, accept a, b, m.

(b) Prove that LCM ∈ P.

## Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
\$26
The price is based on these factors:
Number of pages
Urgency
Basic features
• Free title page and bibliography
• Unlimited revisions
• Plagiarism-free guarantee
• Money-back guarantee
On-demand options
• Writer’s samples
• Part-by-part delivery
• Overnight delivery
• Copies of used sources
Paper format
• 275 words per page
• 12 pt Arial/Times New Roman
• Double line spacing
• Any citation style (APA, MLA, Chicago/Turabian, Harvard)

# Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

### Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

### Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

### Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

### Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Order your essay today and save 20% with the discount code RESEARCH