1

I am trying to solve some practice problems and found this one which I can't solve:

Find all the positive integers such that $n+7$ is divisible by $3n-1$

So far I have tried using the usual properties such as $a|b$ then $a|bc$ ; $a|b$ and $a|c$ then $a|bx+cy$ ; etc but I can't get to anything useful. Just by looking, apparently the answers should be 1 and 4 but that's all I can get.

Here on mathstack I was able to find some similar ones but that only have a number (i.e: 7|[whatever expression] but I don't see how to relate them to mine) If possible, please avoid using congruence for the solution.

Bill Dubuque
  • 282,220

7 Answers7

4

While there are definitely approaches with heavier artillery that will work on more broad versions of this problem, sometimes recognising that you get away with using a peashooter is an important skill as well.

First note that for both positive $a \vert b$ means $a \leq b$, so $3n-1 \leq n+7 \implies n\leq 4$ and there are only four cases to check.

For $n=1$, we get $\frac{8}{2}=4$.

For $n=2$, we get $\frac{9}{5}=1.8$.

For $n=3$, we get $\frac{10}{8}=1.25$.

For $n=4$, we get $\frac{11}{11}=1$.

If you also want to check zero, we get $\frac{7}{-1}=-7$. But if you allow negative number inputs, there is more required.

Nij
  • 2,921
  • Damn, totally ninja'd me lol. Your answer does look nicer anyway – H. sapiens rex Jun 28 '23 at 02:10
  • Checking some MathJax made it take even longer, there were no answers when I started typing. @H.sapiensrex – Nij Jun 28 '23 at 02:12
  • Thanks, it's clearer now. I have two doubts, if we were to allow all the integers then is -7 a solution too? The second question is how would someone solve a broader case? – Dasdawfda Jun 28 '23 at 02:38
  • Yes, -7 is a solution in integers, $\frac{-7 + 7}{3 \times -7 -1}=\frac{0}{-22}=0$. The broader case would be a different question and you should ask it as one. @Dasdawfda – Nij Jun 28 '23 at 04:53
3

Note that if $a$ is divisible by $b$, then $|b| \leq |a|$. So, a necessary (but not sufficient) condition is $|3n - 1| \leq |n + 7|$. Going the lazy route, we can plot the graphs $y = |3x - 1|$ in red and $y = |x + 7|$ in blue and see:

enter image description here

We see that $-\frac{3}{2} \leq n \leq 4$, so we only have to consider the cases $n \in \{-1, 0, 1, 2, 3, 4\}$.

ketsi
  • 3,904
3

Hint:$$22=3(n+7)-(3n-1)$$ Why does $3n-1$ divide $22$? How did we reach this number? List all the factors of $22$ and finish it off.

Sathvik
  • 3,826
  • I can't really see how you got to that expression. It looks like a more general way to approach the solution which would be useful. – Dasdawfda Jun 28 '23 at 02:46
  • 2
    If $a|x$ and $a|y$, then $a|(x-y)$. So, now try making the appropriate manipulations. – Sathvik Jun 28 '23 at 03:04
  • 2
    Yes, your observation is correct. Formally, this is just polynomial division (https://brilliant.org/wiki/polynomial-division/). Also, take a look at division algorithm (https://brilliant.org/wiki/division-algorithm/). – Sathvik Jun 28 '23 at 03:11
  • @Dasdawfda It is easier to "see how to get it" using modular fractions (or inverses) - see my answer. – Bill Dubuque Sep 05 '23 at 01:04
2

Let's start with the basics. If $n+7$ is to be divisible by $3n-1$, then $n+7\ge 3n-1$, which of course means $8\ge 2n \Longrightarrow n\le 4$. Because the question specifies that $n$ be a positive integer, that leaves you with four cases to check: $n \in \{1,2,3,4\}$.

Addendum:

just for fun, let's work out every possible integer value for $n$, not just the positive ones. To do this we will use a modified form of the above argument.

If $n+7$ is divisible by $3n-1$, then $|3n-1|\le |n+7|$. By the definition of absolute value, $|3n-1| = 3n-1$ when $n\ge1/3$ and when $n\lt1/3$, it is equal to $1-3n$. On the other hand, $|n+7| = n+7$ when $n\ge-7$. These facts combine to yield the following set of inequalities over a set of intervals, and we will use these to bound the possibilities for $n$.

Case 1: $1/3 \le n$

I already solved this in my original answer, but it's worth going over again. If $n\ge1/3$, then $|3n-1|\le |n+7| \Longrightarrow 3n-1\le n+7 \Longrightarrow n\le 4$.

Case 2: $-7\le n \lt 1/3$

In this case, the inequality $|3n-1| \le |n+7|$ becomes $1-3n \le n+7$. Solve this for $n$ and you get $-6\le 4n$, or $n\ge -3/2$. Since $n$ has to be an integer, that leaves us with two new possibilities to check: $n=-1$ and $n=0$. If $n=-1$, then $n+7 = 6$ and $3n-1 = -4$. $6$ is not divisible by $-4$, so $n=-1$ is a bust. However, $n=0$ does work (try it for yourself!)

Case 3: $n\lt-7$

When $n\lt-7$, $|3n-1|=1-3n$ and $|n+7| = -n-7$, so $|3n-1|\le|n+7| \Longrightarrow 1-3n \le -n-7$. This implies that $8\le2n$, or that $n\ge 4$. However, $n$ cannot simultaneously be less than $-7$ and greater than $4$; this is a contradiction. Therefore there are no integers $n$ less than $-7$ such that $3n-1$ divides $n+7$.

In full: if $n$ is to be any integer, not just a positive one, such that $3n-1|n+7$, then $n\in \{0,1,4\}$

1

Since $(n+7)$ is divisible by $(3n−1)$, we have

$n+7=k(3n-1)$

$n+7=3nk-k$,

$3nk-n-k-7=0$.

This is a quadratic Diophantine equation. To find the solution, rewrite it into the form of

$(3n-1)(3k-1)=22$

where $22$ can be factorized as the product of $2$ and $11$, which yields two sets of solutions of $(n,k)$ with positive $n$, that is, $(n_1,k_1)=(1,4)$ and $(n_2,k_2)=(4,1)$.

1

Since $3n-1$ divides itself and $3\cdot (n+7)$ we have $$3n-1\mid 3(n+7)-(3n-1)$$ so $3n-1\mid 22$ which means $$3n-1\in\{1,2,11,22,-1,-2,-11,-22\}$$

so $$3n\in\{2,3,12,23,0,-1,-10,-21\}$$

so $$3n\in\{3,12,0,-21\}\implies n\in\{1,4,0,-7\}$$

so we found all integer solutions.

J. W. Tanner
  • 63,683
  • 4
  • 43
  • 88
nonuser
  • 91,557
-1

Easy general ways: translate to gcd form via $\ a\mid b\iff a = \gcd(a,b),\,$ then apply standard (euclidean) gcd methods to computing the gcd, e.g. $\:\!\bf 6\:\!$ ways below (similar to here), which reduces the problem to simply enumerating all divisors of $\:\!\color{#0a0}{22}\:\!$ of the form $\,d = 3n\!-\!1$.


$(1)\,\ \ d\mid n\!+\!7,\,3n\!-\!1\Rightarrow d\mid 3(n\!+\!7)-(3n\!-\!1)=\color{#0a0}{22}\,$ by eliminating $\,n.\,$ Or, said modularly


$(2)\ \ \!\bmod d\!:\ n\!+\!7\,\equiv 0\!\iff\! \color{#c00}{n\equiv -7}\ $ so $\ 3\color{#c00}n\equiv 1\!\iff\! 3(\color{#c00}{-7})\equiv1\!\iff\! \color{#0a0}{22}\equiv 0$


$(3)\ \ $ Euclid $\,\Rightarrow\,$ $(n\!+\!7,3n\!-\!1)=(n\!+\!7,-22),\: $ by $\ 3\color{#c00}n\!-\!1\equiv 3(\color{#c00}{-7})\!-\!1\equiv \color{#0a0}{22}\pmod{\!\color{#c00}{n\!+\!7}}$


$(4)\ \ \begin{bmatrix} 3& -1\\ 1 & 0\end{bmatrix} \begin{bmatrix} n + 7\\ 3n-1\end{bmatrix} = \begin{bmatrix} \color{#0a0}{22}\\ n+7\end{bmatrix} = $ extended Euclidean matrix form of prior.


$(5)\ $ The linear map $\,(n,1)\mapsto (3n\!-\!1,n\!+\!7)\,$ has determinant $\,= 3\cdot 7-(-1)1=\color{#0a0}{22},\,$ hence applying this simple theorem $\ n\!+\!7=\gcd(3n\!-\!1,n\!+\!7)\mid \color{#0a0}{22}\gcd(n,1)= \color{#0a0}{22}$.


$(6)\ $ Put $\,a,b =1,7\,$ in: $ $ by Polynomial Remainder Theorem and $\,(3,3n\!-\!1)=1\,$ we have $$\,3n\!-\!1\mid f(n)\!=\!an\!+\!b\iff 3n\!-\!1\mid 3f(1/3)=3(a/3+b) = \color{#0a0}{a\!+\!3b}\qquad\qquad$$

Bill Dubuque
  • 282,220
  • I think the downvotes could come from the "please avoid using congruence for the solution" in the question. – Dávid Laczkó Oct 03 '23 at 07:48
  • No, most of these downvotes have nothing to do with math. Rather, as usual, they are almost surely political disagreements with my moderation activity (here frequent use of this question as an (abstract) dupe target). – Bill Dubuque Feb 02 '25 at 21:23