So I was solving maths problems in Hackerrank and I found this problem :  . So this problem was little bit of maths so I was facing difficulties to solve this. The description of this problem: Adam is standing at point (a,b) in an infinite 2D grid. He wants to know if he can reach point (x,y) or not. The only operation he can do is to move to point(a+b,b),(a,a+b),(a-b,b),(a,b-a) from some point . It is given that he can move to any point on this 2D grid, i.e., the points having positive X or negative (or Y) co-ordinates. Tell Adam whether he can reach  or not. So I see the answer and the answer was: return gcd(a,b)==gcd(x,y) Which basically means if the gcd of the two initial points and the target points is the same then there exists a solution other there isn't. But I don't understand even a little bit of it why this is the answer.Can you explain me briefly? I understand the mathematical logics but I also wanna understand why it is mathematically correct.
124254
I understand GCD mathematically but i can't figure out where to apply it. For eg I saw this problem today:     Adam is standing at point $(a,b)\in\mathbb Z^2$ in an infinite 2D grid.   He wants to know if he can reach point $(x,y)$ or not.   The only operations he can do is to move to the points $(a+b,b), (a,a+b), (a-b,b)\text{ or }(a,a-b)$ from some point $(a,b)$.   It is given that he can move to any point on this 2D grid, i.e. the pointscan have positive or negative $x$(or $y$) coordinates.      Tell Adam whether he can reach $(x,y)$ or not.   The solution to this problem is simple: If $\gcd(x,y) = \gcd (a,b)$ then adam can reach $(x,y)$ from $(a,b)$, otherwise not.    While this solution is indeed working I am not able to figure out how to come up with it. What is the significance of $\gcd$ in this question?
85782
I guess the canonical proof to this problem is attained using the Euclidean Algorithm (I've seen some posts like this already). I came with this proof, based on gcd definition and some divisibility properties. I'd like to know if it seems correct to you.  Proof:  Let $d$ be a common divisor of both terms. Then $n! +1$ = $d$.$s$ and $(n+1)! +1 = d.t$, for $s, t$ in $\Bbb Z/{0}$. Therefore $(n +1)n! + 1 = n.n! + n! + 1 = n.n! + d.s = d.t$, and it follows that $d|n.n!$. Now, since $n=d(t-s)/n!$, $d|n$. Then $d$ must divide 1 ($n! + 1 = d.s$), and $|d|$ = 1. Being $d'$ another common divisor, it is clear that $d'$ must divide 1 also, and therefore it does divide $d$, so we have $d = gcd(n! + 1, (n+1)! +1) = 1$
910
I stumbled across this relationship while I was messing around. What's the proof, and how do I understand it intuitively? It doesn't really make sense to me that the sum of odd numbers up to $2x + 1$ should equal $x^2$.
38568
Just wanted to share a nice problem.I have given my method below.More answers are welcome.  Consider a rectangular integral grid of size $m*n$.A person has to travel from one end say $(0,0)$ to the diagonally opposite end $(m,n)$.He moves one step at a time towards the east or towards the north(that is,never moves towards the west or south at any time).How many distinct paths exist from the point A to the point C ?
47252
I found this problem in a book and while I understand the given solution, I don't quite understand how somebody would arrive at this solution unless they did out the casework and happened to make the right guesses to solve the problem. Any guidance on solving this from scratch would be greatly appreciated!
46747
Suppose we write each number from $1$ to $n^2$ in an $n\times n$ grid exactly once. Prove there are two adjacent cells such that the absolute value of their difference is not less than $n$.   I think it should be a pigeonhole problem, but the work I did so far was basic observations like if we assume all differences are less than $n$, then neither of $1,2,\dots,2n-2$ could be in the row or the column $n^2$ is placed.  Any hints would be appreciated.
70148
Let $D$ be a , and let $a,b,x \in D \setminus \{0\}$. Then is it true that $\gcd (ax,bx)=x \cdot \gcd (a,b)$ ?    Let $c=\gcd (a,b)$ and $d=\gcd(ax,bx)$, then as $cx|ax$ and $cx|bx$ so $cx|d$. We would be done if we could show $d|cx$, but I am unable to show that. Please help me to solve this problem.
110279
If integers $a$ and $b$ are not both zero, then $\gcd(a,b)=\gcd(a-b,b)$   Assume either $a=0$ or $b=0$. If $a=0$, then $\gcd(a,b)=\gcd(0,b)=b$ and $\gcd(a-b,b)=\gcd(-b,b)=-b$, so $\gcd(a,b)\neq\gcd(a-b,b)$.  If $b=0$, then $\gcd(a,b)=\gcd(a,0)=0$ and $\gcd(-b,b)=\gcd(a,0)=0$.  So, what can I say? Can you help? Can you check my proof-trying?
121884
We know that the ways to go from A to B in a $m×n$ rectangle is $(m+n)!/m!n!$ I want a proof for this formula.(the way should be the shortest.  My Attempt:There is a counting way that may help us.   Every point is calculated by the sum of two adjacent points.
25547
Problem (1.8): There are ten girls and four boys in Mr. Fat's combinatorics class. In how many ways can these students sit around a circular table such that no boys are next to each other.   My Attempt: Total number of ways in which both boys are girls can be arranged on a circular table is $13!$ and the number of ways in which any two boys can be together is $2!*12!$. Therefore the answer is $13!-2*12!=11*12!$. Is this answer correct? I am asking this because I am confused about the exact meaning of the line "no boys are together." Does this mean that no two/three/four boys are together?   Note: Meanwhile I have made another attempt on the problem. We can place the $10$ girls on the circular table in $9!$ ways. Then we are left with $10$ spots which need to be filled with $4$ boys. This can be done in $P^{10}_4$ ways. Thus, the number of ways is $9!P^{10}_4$.
38131
So, if $\gcd(a,b)=1$, then $\gcd(a^2,b^2)=1$ means $1=ax+by$, and want to show $a^2x+b^2y=1$. By squaring $1=ax+by$ both sides, I get, $1=(ax)^2+b(2axby+by^2)$. It doesn't help my proof. Please help me with this proof.
15191
I've done proofs in discrete mathematics, but I'm still at the stage where proofs with more than a few steps make me uncomfortable.  From Apostol's Mathematical Analysis [2nd Ed.] on page 5, we have     Theorem 1.6. Every pair of integers $a$ and $b$ has a common divisor $d$ of the form   $$ d = ax + by $$   where $x$ and $y$ are integers. Moreover, every common divisor of $a$ and $b$ divides this $d$.   The proof (with my questions throughout) goes as follows:     Proof. First assume that $a \geq 0, b \geq 0$ and use induction on $n = a + b$. If $n = 0$ then $a = b = 0$, and we can take $d = 0$ with $x = y = 0$. Assume, then, that the theorem has been proved for $0, 1, 2, ..., n - 1$.   I am a little confused about taking $n$ to be $a + b$, since it's not obvious that all pairs $\{a, b\}$ would be covered by induction for all combinations of $a, b \in \mathbb{Z}$.     By symmetry, we can assume $a \geq b$. If $b = 0$ take $d = a, x = 1, y = 0$.   OK.     If $b \geq 1$ we can apply the induction hypothesis to $a - b$ and $b$, since their sum is $a = n - b \leq n - 1$. Hence there is a common divisor $d$ of $a - b$ and $b$ of the form $d = (a - b)x + by$.   I'm going to let $a' = a - b$, let $b' = b$ and let $d' = a'x + b'y$. (I wish Apostol did something like this to make his proofs clearer.)  I don't understand this logical step. Why does the fact that $a' + b' \leq n - 1$ imply that $d'$ exists and is a common divisor of $a'$ and $b'$? This seems like a huge leap.     This $d$ also divides $(a - b) + b = a$, so $d$ is a common divisor of $a$ and $b$ and we have $d = ax + (y-x)b$, a linear combination of $a$ and $b$.   At this point I am clueless. Why does $d$ divide $a$ and why does this imply it also divides $b$? And where does Apostol get $y-x$ from??     To complete the proof we need to show that every common divisor divides $d$. Since a common divisor divides $a$ and $b$, it also divides the linear combination $ax + (y-x)b = d$. This completes the proof if $a \geq 0$ and $b \geq 0$. If one or both of $a$ and $b$ is negative, apply the result just proved to $|a|$ and $|b|$.   Why not just do the entire proof with absolute values from the beginning?    Soft question: is it normal for authors to be very terse and not explain or give motivation for any steps? How do you go about trying to understand proofs that require a higher level of intuition than you currently have?
22544
If $\gcd(a, b) = 1$ then prove that $\gcd(a+b, a^2-ab+b^2) = 1$ or $3$?  I am shamelessly asking how to solve the problem? I have no idea how to start and solve. Please help.
2120
Problem:  If $\gcd(a, b) = 1$ and If $ab = x^2$ ,prove that $a$, $b$ must also be perfect squares; where $a$,$b$,$x$ are in the set of natural numbers  I've come to the conclusion that $a \ne b$ and $a \ne x$ and $b \ne x$ but I guess that won't really help me.. I understand that if the $\gcd$ between two numbers if $1$ then they obviously have no common divisors but where do I go from this point?  Any tips at tackling this would be great. It looks quite easy though I'm still trying to get my hand around these proofs! Any pointers in the right direction would be great.  Thank you in advance,
64829
I was skimming through Vardi &amp; Zhang's paper on "A modified Weiszfeld algorithm for the Fermat-Weber location problem".   It is available at   If you open the paper and scroll down to page 3, you'll find equation 12, which I found to be odd. There is a lone plus sign in the exponent/superscript. Does anyone know what that means? Could it be that this simply a typo and that the "+" sign refers to an addition operation instead?  Many thanks for your help! Nicolas
2131
I know that $\gcd(a,b)$ divides $a$ and $b$, and must also then divide $(a)(t)$ ($t$ being some integer).  This makes sense to me, but how do I prove it?  It seems that the addition of $(a)(t)$ is a continuation of the linear combination of $\gcd(a,b) = av + bu$ for some $v$, $u$ being elements of $\mathbb{Z}$.    Any help?
8243
If $\gcd(a,b)=1$, how can I find the values that $\gcd(a+b,a^2+b^2)$ can possibly take? I can't find a way to use any of the elemental divisibility and gcd theorems to find them.