How can we determine whether a number is a full shard number?
Without using the floating point function SQRT, we have some good algorithms:
1. Use the same equation: 1 + 3 + 5 + 7 +... + (2 * N-1) = n ^ 2
Bool issqrt (int n)
{
For (INT I = 1; n> 0; I + = 2) N-= I;
Return 0 = N;
}
Copy code
The following describes the mathematical properties of the complete limit number:
It can accelerate the elimination of the full quota:
Property 1: The last digits of the complete number of bytes can only be 0, 1, 4, 5, 6, 9.
Property 2: the odd-square single-digit number is an odd number, and the ten-digit number is an even number.
The odd number must be one of the following five forms:
10a + 1, 10a + 3, 10a + 5, 10a + 7, 10a + 9
After the two squares
(10a + 1) ^ 2 = 100 + 20a + 1 = 20a (5A + 1) + 1
(10a + 3) ^ 2 = 100 + 60a + 9 = 20a (5A + 3) + 9
(10a + 5) ^ 2 = 100 + 100a + 25 = 20 (5A + 5A + 1) + 5
(10a + 7) ^ 2 = 100 + 140a + 49 = 20 (5A + 7A + 2) + 9
(10a + 9) ^ 2 = 100 + 180a + 81 = 20 (5A + 9A + 4) + 1
In summary, we can see that the square of an odd number has an odd number, ranging from 1 to 5 to 9, and the ten digits have an even number.
Property 3: If the ten digits of the complete limit number are odd, its single digit number must be 6; otherwise, if the one digit of the complete limit number is 6, then its ten digits must be odd.
Prove that the value is 10 K + 6, and the value of K is an odd number. Because the number of digits is 6, the number of digits of M is 4 or 6, so m can be set to 10 N + 4 or 10 N + 6. Then
10 K + 6 = (10n + 4) = 100 + (8n + 1) x10 + 6
Or 10 K + 6 = (10n + 6) = 100 + (12n + 3) x10 + 6
K = 10 + 8n + 1 = 2 (5 + 4n) + 1
Or k = 10 + 12n + 3 = 2 (5 + 6N) + 3
∴ K is an odd number.
Inference 1: If a ten-digit number is an odd number and a single-digit number is not 6, the number must not be a complete limit.
Inference 2: if a single digit of the complete number is not 6, its ten digits are even.
Property 4: The square of an even number is a multiple of 4; the square of an odd number is a multiple of 4 plus 1.
This is because (2 k + 1) = 4 K (k + 1) + 1
(2 k) = 4
Property 5: The square of an odd number is 8n + 1, and the square of an even number is 8n or 8n + 4.
In the proof of property 4, from K (k + 1) to an even number, we can get that (2 k + 1) is a number of type 8n + 1; the number can be obtained from an odd or even number (2 k) of Type 8n or type 8n + 4.
Property 6: The number of workers must be in the following two forms: 3 K, 3 k + 1.
Because a natural number is divided by three by the remainder, it can be divided into three types: 3 M, 3 m + 1, 3 m + 2. After the square, obtain
(3 m) = 9 = 3 K
(3 m + 1) = 9 + 6 m + 1 = 3 k + 1
(3 m + 2) = 9 + 12 m + 4 = 3 k + 1
Likewise, we can get:
Property 7: the square of the number that cannot be divisible by 5 is 5k ± 1, and the square of the number that can be divisible by 5 is 5k.
Property 8: The number of workers has one of the following forms: 16 m, 16 m + 1, 16 m + 4, 16 m + 9.
In addition to the single-digit, ten-digit, and remainder attributes, you can also study the sum of the complete-digit numbers. For example, the sum of the numbers in 256 is 2 + 5 + 6 = 13, and 13 is the sum of the numbers in 256. If you add the numbers of 13: 1 + 3 = 4, 4 can also be called the sum of the numbers of 256. The sum of the numbers we mentioned below refers to the sum of the numbers. If the sum of the numbers is not a single digit, the resulting numbers will be added, until it becomes a single digit. We can obtain the following proposition:
The number of a number is equal to the remainder of the number divided by 9.
The following uses four digits as an example to describe this proposition.
If the four-digit value is set
= 1000a + 100b + 10C + d
= 999a + 99b + 9C + (A + B + C + D)
= 9 (111a + 11B + C) + (A + B + C + D)
Obviously, A + B + C + D is the remainder of the four-digit division by 9.
The N-digit number can also be proved by this method.
The number related to the full limit number has the following properties:
Property 9: The sum of the numbers of the complete values can only be 0, 1, 4, 7, and 9.
It is proved that 9 can only be 9 K, 9k ± 1, 9k ± 2, 9k ± 3, 9k ± 4, and
(9 K) = 9 (9) + 0
(9k ± 1) = 9 (9± 2 k) + 1
(9k ± 2) = 9 (9± 4 K) + 4
(9k ± 3) = 9 (9±6k) + 9
(9k ± 4) = 9 (9±8k + 1) + 7
In addition to the above attributes, there are also the following important attributes:
Property 10: a sufficient condition for the number of complete records is that B is the number of full records.
Proof adequacy: If B is set to the number of workers
= (AC)
Necessity: if it is a full shard number, =, then
Property 11: If the prime number P can divide a, but the square of P cannot divide a, then a is not a complete number.
It is proved by the question that A has a prime factor P, but no factor. It can be seen that when a is decomposed into a standard formula, the sub-division of P is 1, and the total number of workers is decomposed into a standard formula, the power of each prime factor is an even number. It can be seen that A is not a full number of workers.
Property 12: All integers between two adjacent integers are not full integers.
N ^ 2 <k ^ 2 <(n + 1) ^ 2
Then K must not have a full number of shards.
Property 13: a positive integer N is a sufficient and necessary condition for the total number of integers. N has an odd number of factors (including 1 and N ).