Lightoj1236-pairs Forming LCM (lcm+ unique decomposition theorem)

Source: Internet
Author: User
Topic Links:

https://vjudge.net/problem/LightOJ-1236 topic:

Given a number n N, to satisfy I≤J<N∧LCM (i,j) =n i \le J (i,j) (I, j) for a total number of. Problem Solving Process:

Thought for a while ... No, look at the blog, just as a conclusion OK. Topic Analysis:

For each pair (I,J) (I, j), the unique decomposition theorem can be written as follows:
N=pe11⋅pe22...pekk n = p_1^{e_1} \cdot p_2^{e_2} \dots P_k^{e_k}
I=pa11⋅pa22...pakk i = p_1^{a_1} \cdot p_2^{a_2} \dots P_k^{a_k}
J=PB11⋅PB22...PBKK j = p_1^{b_1} \cdot p_2^{b_2} \dots P_k^{b_k}

The necessary and sufficient condition to make the LCM (i,j) =n LCM (i, j) = n is to satisfy Max (AI,BI) =ci

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.