For C (n, k) modulo, k350c Mold

Source: Internet
Author: User

For C (n, k) modulo, k350c Mold

2016.1.26

 

Method 1: Calculate the multiplication inverse element based on the definition.

Method 2: Use n! Mod p, which can be solved based on the definition of C (n, k) and multiplication inverse element.

Method 3: solving with Lucas Theorem

 

NOTE: In the case that the C (n, k) modulo p is equal to 0, the above method does not work, so we need to determine it.

Example of Special Determination Method: for example, if the number of factor p in the numerator is e1 and the number of factor p in the denominator is e2, then When e1 = e2, the module p cannot be 0, continue. If e1> e2, p is 0 and 0 is returned directly.

For example, when method 3 is adopted, there is such a sentence: C (a, B) the necessary and sufficient condition for mod p not equal to 0 is that every bit of a in p-base is not smaller than the corresponding bit of B in p-base, C (a, B) the necessary and sufficient condition for p to be equal to 0 is that a has at least one bit smaller than B in p base.

It doesn't matter if you don't understand it. Read this question and you will understand: the Cong examination (mainly the part of the Lucas theorem)

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.