Continuous Addition of Natural Numbers

Source: Internet
Author: User

Some numbers in a positive integer can be obtained by the addition of consecutive natural numbers, such

1 + 2 = 3

4 + 5 = 9

2 + 3 + 4 = 9

Three of its problems are listed here:

1. Write a program. For any 64-bit positive integer, output the formula of all its possible continuous natural numbers?

2. What kind of number cannot be obtained by adding continuous natural numbers and prove it?

3. Which of the following is the maximum number of subsequences in the 64-bit Positive Integer Range? Can I use mathematical knowledge to export data? (Not made)

My analysis:

1. List and summarize analysis

First, I listed 1 ~ It is possible to accumulate all positive integers within 20.

1 impossible

2 impossible

3 = 1 + 2

4 impossible

5 = 2 + 3

6 = 1 + 2 + 3

7 = 3 + 4

8 impossible

9 = 4 + 5

10 = 1 + 2 + 3 + 4

11 = 5 + 6

12 = 3 + 4 + 5

13 = 6 + 7

14 = 2 + 3 + 4 + 5

15 = 1 + 2 + 3 + 4 + 5

16 impossible

17 = 8 + 9

18 = 3 + 4 + 5 + 6

19 = 8 + 9

20 = 2 + 3 + 4 + 5 + 6

The above list only lists the groups and methods of possible numbers (for example, 15, 7 + 8, 4 + 5 + 6, 1 + 2 + 3 + 4 + 5, here is only one example ).

Conclusion:

I found that the only positive integers (1, 2, 4, 8, and 16) that are not allowed to accumulate natural numbers are the N power of 2.

1 = 2 ^ 0, 2 = 2 ^ 1, 4 = 2 ^ 2, 8 = 2 ^ 3, 16 = 2 ^ 4

Therefore, for the second question, this conclusion is my hypothetical answer (It will prove later)

2. Split the number to get the formula

Suppose there is a positive integer N, and it can be obtained by the addition of continuous natural numbers. Get

N = A1 + A2 + A3 +... ... + An (A1, A2, A3... An
Are continuous natural numbers)

However, A1, A2, A3... An can be split into the following forms:

A1 = 1 + k

A2 = 2 + k

A3 = 3 + k

... ...

An = N + k

N is a positive integer, K is a positive integer, or 0

Then N is changed to the following form:

N = (1 + k) + (2 + k) + (3 + k) +... ... + (N + k) = (1 + 2 + 3 +... ... + N) + K * n = 1/2*(1 + n) N + kN = f (n, k)

That is to say, the number of any continuous natural number can be obtained by function f (n, k.

(The above implied condition is that n = 1 is not true. Because n represents the number of consecutive natural numbers, it is meaningless when n is 1 .)

(Note: In fact, a better derivation method is derived based on the sum formula of the arithmetic difference series. I don't need to evaluate the equidifference sequence because I personally think this method is easier to find in programming. Finally, the specific implementation code is provided .)

3. Prove the relationship between the formula and my hypothetical answers

Assume that function f is equal to 2 ^ m (in order not to confuse the N on both sides of the equation, I use M to represent the power of 2)

F (n, k) = 1/2*(1 + n) N + kN = 2 ^ m

(1 + n) N + 2kn = 2 ^ (m + 1)

N (2 k + 1) + n) = 2 ^ (m + 1)

N (2 k + 1) + n) on the left of the equation, No matter what number N and K take, the result of N (2 k + 1) + n) must beOdd x even = evenAnd the even number cannot be deduced not to the Npower of 2. However, this conclusion (Odd x even. I will continue to prove it.

Suppose n (2 k + 1) + n) = z.

Because Z is an even number, it must be able to be split into z = 2 x Z1. if z1 is an even number, it must be able to be split into z1 = 2 x Z2, and so on. Z (n-1) must be available) = 2 × Zn, thenZ = 2 × 2 ×...
... × ZN = 2 ^ n × Zn

Here Zn represents an odd number of 2 not allowed.

If the odd number can be split into two numbers and multiplied, two odd numbers (O1, O2) must be obtained ). If there is at least one of O1 and O2 that can be further split into two odd numbers, then the odd numbers of O3 and O4 are obtained. In the end, the odd number that cannot be split may bePrime Number. That is to say, the conclusion above is that Zn is equal to a group.Prime Number and the N power of 2Multiply. If the number of elements in this group of prime numbers is 0, we assume that the product is 1.

So far, I have come up with an interesting inference:

For the continuous Natural Number Addition function f (n, k), it is inevitable that a group of continuous prime numbers can be multiplied (pn1 × pn2 × pn3 ×...
... Pnx) × 2 ^ n = 2 ^ (m + 1)

(Pn1 × pn2 × pn3 ×... ... Pnx) = 2 ^ (m + 1-N)
(M + 1> = N)

That is to say, when and only when the number of prime numbers in this group is 0, the product is 1 and N = m + 1, the sum of continuous natural numbers is equal to the N power of 2.

However, according to the function formula, the sum of continuous natural numbers must be the product of an odd number × an even number, and at least one non-1 odd number exists. If the odd number is 1, the value obtained by the function is only 1, and 1 obviously does not match the meaning of the question. The number in the question is at least three, and 3 is the sum of the smallest continuous natural numbers.

Therefore, the function f (n, k) derived from the sum of continuous natural numbers must not be equal to the N power of 2.

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.