Intimate number pair (including discussion of the most common factor)

Source: Internet
Author: User
ArticleDirectory
    • # Result:
    • 1. maximum co-factor (GCD)
    • 2. Definitions of intimacy data pairs
    • 3. Implementation of intimate number pairs (Python)

 

1. GCD recursion theorem and proof

GCD recursion theorem refers to gcd (a, B) = gcd (B, A % B), where % indicates taking the remainder.

Proof:

We only need to prove that gcd (A, B) and gcd (B, A % B) can divide each other.

For gcd (a, B), it is the smallest positive element in the linear combination of A and B. gcd (B, A % B) is a linear combination of B and A % B, while a % B is a linear combination of A and B, gcd (B, A % B) is a linear combination of A and B, because, B can be divisible by gcd (a, B), so any linear combination of A and B can be divisible by gcd (a, B), so gcd (B, A % B) can be divisible by gcd (A, B. And vice versa.

2. Definitions of intimacy data pairs

If the factor of A and is equal to B, the factor of B and is equal to a, the factor includes 1 but does not include itself, and A is not equal to B, it is called a, B is the number of intimacy. Generally, the corresponding intimate number pair is obtained through the stacked generation programming.

3. Implementation of intimate number pairs (Python)

# Result:

# [(220,284), (1184,121 0), (2620,292 4), (5020,556 4), (6232,636 8)]

 

 

 

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.