It was evening before bedtime. I brushed my teeth and wearily looked at the mosaic in the bathroom. For some reason, I was interested in such a simple fact: if a rectangle of 2 Γ 3 cells is rounded on both sides with cells, then the stroke area will be the same as the area of ββthe rectangle:
I wondered if there are more similar configurations. That is, to a rectangle a timesb draw a contour from two sides, and the contour area coincided with the area of ββthe rectangle. Of course a and b must be whole:
It seems that such cases should no longer be. Blue area a timesb , and yellow - a+b+1 . It is seen that if a or b one, then there will be no coincidence, and if you increase them more 2 times3 , the blue will obviously grow faster. So this configuration is one.
Bored, said the brain. We must weaken the task. So to speak:
But now the task is too weak. In fact, it is necessary to choose two rectangles with integer sides, so that their areas differ exactly by half. And the only restriction on the rectangles is that one can be shoved into the other. There are too many, too boring. Let's go like this:
Fix the width of the edging. Are there many such? Hm Looks more interesting. Yellow Square is (x+a)(x+b)βab and we want it to be just ab . That is, we (me and my brain, which has pulled me into this) need to solve the equation:
(x+a)(x+b)βab=ab
Or, which is the same:
x2+ax+bxβab=0
By this time I was done with my teeth and began to pour the powder into the dishwasher. Aha, said the brain, a good challenge. It is necessary to solve, of course, in integers, that is, this is a Diophantine equation . We did not pass the Diophantine equations at the university, but I remembered something about popular articles about them. Namely:
In this way, for example, the general formula for all Pythagorean triples is easily found. By the way, as with the Pythagorean triples, in our problem any number of multiple solutions. For example, a rectangle 4 times6 You can expand the edging in two squares and so on. Of course, we are interested only in non-multiple decisions.
Will I be able to do all this in my mind, I thought, picking up a humidifier. Algebra without a piece of paper and a computer is a rather insidious thing: mixed up with a minus or forgot some member, and further calculations for nothing. Programmers know what to do to reduce the likelihood of an error - it is necessary to overlap with unit tests. Fortunately, we already know one solution: x=1;a=2;b=3 . We will check it at every step.
12+2 times1+3 times1β2 times3=0
So far, so good. So, we have a homogeneous equation - all terms are in the second degree. Let's divide the equation by x2 (happening x=0 we are not interested, so it is possible to divide):
1+ fracax+ fracbxβ fracax times fracbx=0
We make a replacement: p=a/x;q=b/x and we get an equation with two rational variables:
1+p+qβpq=0
In our unit test p=2;q=3 , the test passes. Now we must draw a straight line. In principle, it can be carried out just through the point (2;3) but it's hard to keep in the brain. But by the method of intent peering, we can easily find another point that satisfies the equation: p=β1;q=0 . This corresponds to zero area. a timesb and again as a solution is not very interesting, but for holding a straight just right. Itβs pretty easy to see that all the lines (except one) going through p=β1;q=0 described by an explicit equation q= alpha(p+1) (yes, for some reason, the brain issued a Greek letter, although the Latin ones were not yet over). One missing line is p=β1 She is also not very interesting to us. Of course, any rational point (p;q) where p neqβ1 corresponds to rational alpha . For example, for the point (2;3) value alpha=1 . Substitute the equation of a line into our equation and get:
1+p+ alpha(p+1)β alphap(p+1)=0
Or
1+p+ alphap+ alphaβ alphap2β alphap=0
Or
1+p+ alphaβ alphap2=0
Or
alphap2βpβ(1+ alpha)=0
In the head it becomes difficult to bring members, the brain desperately asks for a piece of paper. But I lull in the hands of the baby, there is no time for paper. Run the unit test ( p=2; alpha=1 ):
1 times22β2β(1+1)=0
Fuf, so far so good. Now we have a quadratic equation for p which actually should give a rational root to any rational alpha . How can this be, is there a discriminant and all that? Okay, let's try:
D=b2β4ac=12+4 alpha(1+ alpha)=1+4 alpha+4 alpha2=(1+2 alpha)2
Oh, oh, well, like, a full square came out. Endorphin went to the brain. He, a kind of drug addict, seemed to be seeking this. Here it is the magic of mathematics: a rational number had to come out and work out. We recall the formula for the roots:
p1,2= fracβb pm sqrtD2a
Or in our notation:
p1= frac1β(1+2 alpha)2 alpha=β1
p2= frac1+(1+2 alpha)2 alpha= frac1+ alpha alpha
p1 - this is our pivot point β1 it is not interesting to us. Our solution is p2 . Substituting it into q= alpha(p+1) we get the answer:
p= frac1+ alpha alpha;q=1+2 alpha
That is, you just need to sort out all the rational fractions as alpha and for them we get all rational solutions of the equation 1+p+qβpq=0 (well, except for some that are not very interesting to us).
Of course, it is easier to sort integers, not rational ones. Soldering the baby simethicone, I substitute alpha=m/n and get:
p= frac1+ fracmn fracmn= fracn+mm
q=2+ fracmn= fracn+2mn
(God, brain, why did you choose m and n ? They are so easily confused in the head! Are there few letters?) In our unit test, if alpha=1 then fit m=n=1 and it's easy to make sure the test passes.
How do we get back to integers? Remember that we replaced p=a/x;q=b/x . So, we must take for x any number multiple to a common denominator from formulas above. In particular, fits just mn . As a result, we have:
x=mn;a=mn+n2;b=mn+2m2
It is seen that if m and n not mutually simple, then the solution will be a multiple of their common divisor, so we are only interested in mutually simple m and n . The multiple solution will also work if n will be even. In fact let n=2nβ² . Then
x=2mnβ²;a=2mnβ²+4nβ²2;b=2mnβ²+2m2
If you divide everything by two, we get
x=mnβ²;a=mnβ²+2nβ²2;b=mnβ²+m2
This solution is symmetrical to the first, which is quite logical: after all, the problem is symmetric with respect to a and b . Thus, we are interested in mutually simple m and n , and n is odd.
Conveniently, that expression for x It turned out so simple. So, we have an easy way to find all non-multiple solutions for a predetermined width of the edging. x : these are rectangles a=x+n2;b=x+2(x/n)2 where n any odd divider x mutually simple with x/n . The next rectangle will be for x=2;n=1;m=2;a=3;b=$1 :
Both the blue and yellow parts contain exactly 30 cells!
Let's see what else there are solutions for small ones. x ( a and b I rearranged in some places to go up):
x | n | m | area without edging | square with edging |
---|---|---|---|---|
one | one | one | 2 Γ 3 = 6 | 3 Γ 4 = 12 |
2 | one | 2 | 3 Γ 10 = 30 | 5 Γ 12 = 60 |
3 | one | 3 | 4 Γ 21 = 84 | 7 Γ 24 = 168 |
3 | 3 | one | 5 Γ 12 = 60 | 8 Γ 15 = 120 |
four | one | four | 5 Γ 36 = 180 | 9 Γ 40 = 360 |
five | one | five | 6 Γ 55 = 330 | 11 Γ 60 = 660 |
five | five | one | 7 Γ 30 = 210 | 12 Γ 35 = 420 |
6 | one | 6 | 7 Γ 78 = 546 | 13 Γ 84 = 1092 |
6 | 3 | 2 | 14 Γ 15 = 210 | 20 Γ 21 = 420 |
With these works in mind, the brain again achieved a dose of endorphin. How beautiful and wonderful dividers flow from one number to another! Take for example 6 times55 : the first is divisible by 6, and the second by 11. We add the five to both numbers, and the miracle is now the first is divisible by 11, and the second is by 6. And such tricks in every line! And then the son seemed to calm down. Eleven in the evening, you can go to bed.
Perhaps this can all be considered easier. Perhaps my reasoning was somewhere inaccurate. Perhaps these numbers and works have some special name. I do not know - not looking. I am more interested in this: I am just occupying my mind with such nonsense, or you, too, are suffering are you enjoying? Will they cure us?
Source: https://habr.com/ru/post/350640/
All Articles