# Digital puzzles or algorithms Section (7)

Source: Internet
Author: User

1. It is a 10*10 number table. The diagonal line of the table is a series of repeated numbers. Try to calculate the sum of all the numbers in the table.

Answer: The sum of the numbers is 1000.

For example, I think a lot of people will think of it intuitively-finding a rule. Indeed, it will be easier to find a rule and what will happen later.

The first method is calculated based on the symmetry of the square.

The sum of the numbers in the upper left and lower right corner is 20, and the average is 10 (for example, 1 + 19, 2 + 18, 3 + 17, 4 + 16, etc.), that is, the number in the table

The sum is not changed. That is, the total number is 10*10*10 = 1000.

Method 2: Calculate by row or column.

The sum of the numbers in the first row = 1 + 2 + 3 +... + 9 + 10 = (1 + 10) * 10/2 = 55.

The sum of the numbers in the second row is 55 + 10. Because each number in the second row is 1 larger than that in the first row.

The total number in the third row is 55 + 20.

And so on...

The total number in the Tenth row is 55 + 90.

Total number = 55 + (55 + 10) + (55 + 20) + (55 + 30) +... + (55 + 90) = 55*10 + (10 + 90) * 9/2 = 1000.

It can be seen that a simple mathematical summation formula plays a huge role here.

The summation formula is prototype:

1 + 2 + 3 +... + N-1 + n = n (n + 1)/2

Deformation: Calculate the sum of the First n positive and even numbers:

2 + 4 + 8 +... + 2n = 2 (1 + 2 +... + N) = n (n + 1)

Deformation: Calculate the sum of the First n positive odd numbers:

1 + 3 + 5 +... + (2n-1) = (1 + 2 + 3 +... + (2n-1) + 2n)-(2 + 4 + 6 +... + 2n) = 2n (2n + 1)/2-n (n + 1) = n2

Another very important formula: the sum of the two power pairs:

20 + 21 + 22 +... + 2n = 2n + 1-1.

2. Calculate the product of any two 18-digit integers and the number of consecutive numbers 0 at the end of the result.

Note: The number of consecutive numbers at the end of the result is 0.

Assume that the product of two numbers is 21601 .. 800000000.

The result can be expressed as follows: 21601 .. 8*108

Because 10 can only be divided into 2*5, it can also be expressed as: 21601 .. 8 * (2*5) 8

Therefore, we can use the following method to calculate the result:

1. separate the two multiplier values into the prime factor (only 2 or 5 ).

2. Calculate the number of prime factor 2 and prime factor 5 respectively.

3. Min (number of prime factor 2, number of prime factor 5) is the result.

The preceding section describes addition and multiplication. The following section describes how to obtain the remainder.

3. Obtain the result of 7 remainder of any 100-bit integer pair.

Think about it. What will we do if we use a pen to calculate the problem? -- Vertical division.

Yes, we will use the original primary school students to solve this problem by Division and vertical division.

Method description:

First, extract the first digit of the 100-digit number, and divide the remainder by 7 (the remainder may be 0 ).

Use the second digit of the remainder and 100 digits to form a two-digit or one-digit number (because the remainder may be 0), and then divide the remainder by 7.

And so on.

Well, let's appreciate the charm of mathematics. Thank you for your attention ~

Related Keywords:
Related Article

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.