Combined mathematical knowledge points
Mathematics
1. prime number, log, binary, question proof
2. Formula for troubleshooting the principle of rejection
3. the interconnectivity with a number a must be c + ka, and c is the number of interconnectivity with a within. Happy June 2006
4. For any integer n, there must be a multiple consisting of no more than two numbers. Because a, aa, aaa ...... If n + 1 is used, the remainder of two modulo n must be the same, and the offset is the multiple of n m. M is only composed of a and 0. 5. for large numbers, the same modulus theorem is generally used to reduce the scale (a + B) % m = a % m + B % m, (a * B) % m = a % m * B % m
Combined mathematics
Classification of addition and multiplication principles, step by step
Formula D (n) = (n-1) [D (n-2) + D (n-1)]
Step 1: place the nth element in a single position, such as position k. There are n-1 methods in total;
Step 2: place the element number k in two cases: (1) place it in position n. Then, for the remaining n-1 elements, since the k element to the position n, the remaining N-2 element has D (n-2) method; (2) the k element does not put it to the position n, then, for the n-1 elements, there are D (n-1) methods;
/* The Sky Code is used to calculate the number of n groups (a, B, c, d) with a public number of 1. It is worth noting that these four numbers do not necessarily have mutual quality. Therefore, from the opposite side, we first find the number of a common approx. Not 1. Train of Thought: decompose each number prime number, record the factors that can be composed of Non-repeated prime factors, and count the total number of these factors, and count how many prime factors each factor is composed of. For example, the number of the n numbers containing 2 is a, the number of 3 is B, and the number of 6 is c, then, the total number of common approx values greater than 1 is p = c (a, 4) + c (B, 4)-c (c, 4), and the total number is c (n, 4) use c (n, 4)-p as the request */# include
# Include
# Include
# Define MAXN 10000 + 100 _ int64 A [MAXN] ;__ int64 B [MAXN] ;__ int64 C [MAXN] ;__ int64 P [MAXN] ;__ int64 N; __int64 num ;__ int64 yz; void dfs () {__ int64 I, j ;__ int64 temp, k; yz = 0; for (I = 2; I * I <= num; I ++) {if (num % I = 0) {C [yz ++] = I; while (num % I = 0) num/= I ;}}if (num> 1) C [yz ++] = num; // stores the quality factor for (I = 1; I <(1 <