I tried using the fact that if $f(n)$ is divisible by $7$ then so will $f(n+7)$. So 1, 8, 15, 22 can all come out to be solutions once we see that $1$ is a solution. Continuing this $2$ also satisfies and hence $9, 16$ will also be solutions to it. But this seems a lot of brute force work. I used Wolfram alpha to solve $$n^5 +4n^4 +3n^3+2022 \pmod7, 0<n\leq 22$$ and it gives me $n = 1,2,5,8,9,12,15,16,19,22$ and so there are 10 such n. But how do I solve it? Is there a shorter way?
-
4As you have said, it suffices to work $\pmod 7$. But quintic equations are hard to solve generally, so simply trying the $7$ possible classes $\pmod 7$ is likely to be close to optimal. – lulu May 08 '23 at 17:59
-
2FYI, one thing which might help to reduce the calculations a bit is to note that $n^5+4n^4+3n^3=n^3(n+3)(n+1)$. – John Omielan May 08 '23 at 18:10
-
@luli Yes, I agree it's much better than some of the other modular arithmetic questions and it just comes down to testing the 7 cases after the basic reduction of 2022 mod7 = 6 mod7. It's just that I was looking for an Olympiad based perspective or technique or trick to reduce and solve it. Thanks! – Solus May 08 '23 at 18:43
-
@JohnOmielan Can you please explain how can I use that fact? I mean right now I have to put n=0,1,2,3,4,5,6 and check if the result is divisible by 7, how do I reduce calculations? – Solus May 08 '23 at 18:49
-
2Following up on John Omielan's comment, since $2022 \not\equiv 0 \bmod 7$, we can see that any $n$ which results in $n^3 \equiv 0 \bmod 7$ or $n+3 \equiv 0 \bmod 7$ or $n+1 \equiv 0 \bmod 7$ cannot afford a solution. That only leaves $n \equiv {1,2,3,5} \bmod 7$ to consider. Not a lot of work to show that only $n \equiv 3 \bmod 7$ does not afford solutions, leading to the answer you identified. – Keith Backman May 08 '23 at 18:50
-
1One easy way ($< 20$ seconds) is to write $f(n)$ as $\rm \color{#c00}{odd}$ + even part, then eval at $,n\equiv \pm{1,2,3}$, i.e. $\bmod 7!:\ f(n) \equiv \color{#c00}{n^3(n^2!+3)} + 4n^4!-!1\equiv \underbrace{\color{#c00}{\pm4}!+!3}{\large n\ \equiv\ \pm1},, \underbrace{\color{#c00}{\pm0}!+!0}{\large n\ \equiv\ \pm2},,\underbrace{\color{#c00}{\pm2}!+!1}_{\large n\ \equiv\ \pm3}$ so the roots are $,n\equiv +1,\pm2.\ \ $ – Bill Dubuque May 08 '23 at 18:55
-
@KeithBackman Got it, that's much better. Thanks! – Solus May 08 '23 at 19:06
-
@BillDubuque So after writing it as even+odd in terms of powers, you are putting $n=\pm 1,2,3$ but I don't understand why? Can you please explain a bit more? – Solus May 08 '23 at 19:20
-
1It's an optimization to halve the number of evaluations: if $,g(n),$ is odd then $,\color{#c00}{g(\pm a) \equiv \pm g(a)};,$ if its even then $,g(\pm n) \equiv g(n),,$ e.g. evaluating $f(n)$ at $,n\equiv \pm1$ we get $,\color{#c00}{n^3(n^2+3)\equiv \pm1(1+3)},,$ and $,4n^4-1\equiv 4-1$ so their sum $,f(n)\equiv \color{#c00}{\pm4}+3,,$ which is $\equiv 0$ only for $\color{#c00}{+4}+3$, i.e. $n\equiv +1$ case. – Bill Dubuque May 08 '23 at 19:41
-
1Note $,0,\pm,1,\pm2,\pm3,$ is a complete system of residues $!\bmod 7,,$ and clearly $0$ is not a root. See balanced (signed) residue system. – Bill Dubuque May 08 '23 at 19:45
-
@BillDubuque Got it, that's also a nice way to reduce calculations. I didn't understand what you were trying to convey before, perfectly clear now! – Solus May 08 '23 at 20:39
4 Answers
Note that $$2022\equiv6\equiv -8\pmod7$$
So we have
$$n^5 +4n^4 +3n^3+2022\equiv n^5 +4n^4 +3n^3-8\pmod7$$
where
$$\begin{align}n^5 +4n^4 +3n^3-8&=(-1 + x) (2 + x) (4 + 2 x + 3 x^2 + x^3)\\ \\ &=(-1 + x)\cdot (2 + x) \cdot[4 + x(x+1)(x+2)] \end{align}$$
So it is either
$$7|(x-1),~~~\text{or}~~~7|(x+2),~~~\text{or}~~~x(x+1)(x+2)\equiv 3\pmod7$$
- 21,529
-
You pull an answer (factorization) out of hat - like magic. But magic is not math. – Bill Dubuque May 08 '23 at 18:30
-
1@BillDubuque this answer can teach one to do this magic and will serve as a good complement to this post – Sgg8 May 08 '23 at 18:35
-
If you are using some math method (vs. magic) then you should say what method that is and give the details of how it works here (in the answer, not in a comment). – Bill Dubuque May 08 '23 at 18:37
-
The idea is to look for integer roots of the polynomial by using the rational root theorem. So we need to manipulate the constant term. First reduce 2022 to 6, then add/subtract 7, 14 to factorize it. Fortunately, -14 works. @BillDubuque – MathFail May 08 '23 at 18:47
-
1But the Rational Root Test will generally be useless for determining all modular roots. It is sheer luck that it helped at all here. This is not a good way in general. I recommend that you delete this answer since it is misleading in general for problems like this. – Bill Dubuque May 08 '23 at 18:58
-
To elaborate why did you choose the rep $-8$ for the constant term, instead of other congruent values like $-15,-1,6,13, 20,$ etc? If you chose other values (e.g. odd ones) then your method will miss the root $2$. It is ad hoc and pure luck that it works here, and much more work than simply brute force testing $n\equiv \pm1,2,3,$ (cf. my comment on the question). – Bill Dubuque May 08 '23 at 19:14
-
Wow! If you can think of a factorizing it then it becomes super simple, works like a charm here. Thanks! I don't understand why it's a bad idea though. Is it possible that this method does not yield all modular roots in any general case? Why? – Solus May 08 '23 at 19:23
-
@Solitary Please see my prior comment. If we instead chose the more natural value $-1$ for the constant term then we would miss the roots $\pm2$ using RRT. Lacking any explanation, it is pure luck that the choice $-8$ yielded a root in $\Bbb Z$. Generally modular roots need not be roots in $\Bbb Z$ so RRT will not find them, e.g. all $n\not\equiv 0$ are roots of $,x^6-1,$ but RRT tests only $,n\equiv \pm1\ \ $ – Bill Dubuque May 08 '23 at 19:58
-
No, you misunderstand what I did here. When I say rational root test, it only means to use those roots to factorize the polynomial, I don't take those roots as the roots for modular equations. @BillDubuque – MathFail May 08 '23 at 20:02
-
@MathFail No, I understand how you applied RRT. But it seems you don't understand my explanation why it is pure luck and not generally useful. Please explain why you chose $-8$ instead of $-1$ for the constant term. Lacking such it is ad-hoc and amounts to guessing the roots (and is more work than guessing and checking modular roots) – Bill Dubuque May 08 '23 at 20:08
-
If choose $-1$, then the polynomial couldn't be completely factorized. @BillDubuque – MathFail May 08 '23 at 20:16
-
Exactly, you had to guess a constant term $\equiv -1$ that yields a root over $\Bbb Z$. Either you had a lucky guess (or maybe you already knew $2$ was a root so you looked for an even constant term $\equiv -1)$. As I explained above this will fail miserably in general. – Bill Dubuque May 08 '23 at 20:24
-
@BillDubuque I understand that it won't work for all cases if we aren't able to factorize the polynomial. But what's wrong with this method if we're able to figure out that the polynomial can be factorized by doing $\pm 7 (mod 7)$ (For context, this problem is indeed olympiad oriented and so being able to factorize is a test of mathematical aptitude and I guess they probably wanted us to do that?) – Solus May 08 '23 at 20:33
-
My purpose is to completely factorize the polynomial, if I use odd, such as $-1, 13$, the polynomial couldn't be factorized. I have to try even integer as the constant term. But I don't get why you said if the constant term is odd then we will miss solutions to the modular equation. Because for odd constant term, the polynomial cannot be factorized, so we have to consider the entire polynomial in all, so we don't lose any solution. Do you mean, for example $x^5+...+6\equiv 0\pmod 7$ and $x^5+...-1\equiv 0\pmod 7$ don't have the same solutions? @BillDubuque – MathFail May 08 '23 at 20:36
-
@MathFail please explain how to use your method to find all roots of $,x^{162}-1\pmod{!163}\ \ $ – Bill Dubuque May 08 '23 at 20:49
-
Can you first explain why you said for odd constant term will lose solutions? Let $P(x)=x^5 + 4 x^4 + 3 x^3 - 1$, so $P(2)=119$, and $7|119$, we didn't miss any solutions. @BillDubuque – MathFail May 08 '23 at 21:09
-
How is that supposed to be related to the RRT method you say you used in your answer? If you used RRT with constant term $-1$ yould only look for roots $\pm1$ in $\Bbb Z\ \ $ – Bill Dubuque May 08 '23 at 21:14
As you note, if $n$ is a solution then so is $n+7$, and hence it suffices to check whether $7$ divides $$n^5+4n^4+3n^3+2022,$$ for $0\leq n\leq 6$. It is easy to check that $2022\equiv6\pmod{7}$ and so the above reduces to $$n^5+4n^4+3n^3+6.$$ Clearly $n=0$ is not a solution. For all other $n$ you have $n^3=\pm1$ and so the above reduces to $$\pm(n^2+4n+3)+6.$$ Then it remains to compute six values of this quadratic for $1\leq n\leq 6$, which should be much quicker than computing six values for the original quintic.
- 67,306
- 8
- 82
- 171
-
-
-
@Servaes This is helpful! I did figure this out though after some great answers on this post opened my high school student mind to so many possibilities. Thanks! – Solus May 08 '23 at 21:06
From $n^5+4n^4+3n^3+2022$ we get $$n^3(n+1)(n+3)\equiv1\pmod7$$ so if $f(n)=n^3(n+1)(n+3)$ the only classes modulo $7$ such that $f(n)=1$ are for $n=1,2$ and $5$. Then all the required solutions must be such that $$1\le7k+1, 7k+2,7k+5\le22$$ then the solutions are $1,2,5,8,9,12,15,16,19,22$ and consequently the required number of solution is $\boxed{10}$.
- 32,657
in the given equation,
$$n^5+4n^4+3n^3+2022$$ notice, $$2022\equiv-1\pmod7$$ so we need to find n such that, $$n^5+4n^4+3n^3\equiv1\pmod7$$ $$\implies n^3(n^2+4n+3)\equiv1\pmod7$$ $$\implies n^3(n+3)(n+1)\equiv1\pmod7$$ therefore we need to find the following: $$n=7k+1$$ or $$n^3=7k+1$$ giving us $n=7k+2$ ($(7k+2)^3 = 7k'+1$)
or $$(n+3)=7k+1$$ but not $$(n+1)=7k+1$$ because if $(n+1)$ is $7k+1$ then $n$ will be divisible by $7$
$\therefore$ n will be of the following forms $$n=7k+1$$ $$n=7k+2$$ $$n=7k+5$$
from the above equations, we find $$n = 1,2,5,8,9,12,15,16,19,22$$ will be the answers
EDIT: why is this downvoted? if I'm wrong somewhere I'd be glad to be told where I made the mistake.
EDIT: The step where I mentioned $n=7k+2$ may not be clear or justified so lemme just clear that up. $$n=7k+2$$ $$\implies n^3 = (7k)^3+3(7k)^22^1+3(7k)^12^2+2^3$$ $$\implies (7k)^3+3(7k)^22^1+3(7k)^12^2+7+1$$ $$\implies 7((7^2k^3)+3(7k^2)2^1+3(k^1)2^2+1)+1$$ $$\implies 7m+1$$
- 7
- 3
-
got it, this too can immediately help us in figuring out the base solution of 1,2, and 5. Thanks! – Solus May 08 '23 at 19:26
-
1No, this is incorrect. For example, $2\neq 7k+1$ and $4\neq 7k+1$, but $$2\cdot4\equiv 1\pmod7$$ @SolitarySolus – MathFail May 08 '23 at 20:06
-
@MathFail dude, 2 is 7k+2, put k=0. the $n^3$ makes it $2^3$ which is 8. – rapidfire69 May 08 '23 at 20:10
-
1@MathFail if there was a confusion, n can be of any form of the given above equations. i.e. $$n=7k+1$$ $$n=7k+2$$ $$n=7k-2$$ where $0<n\leq22$ I hope this clears any misunderstandings in my answer – rapidfire69 May 08 '23 at 20:28
-
@MathFail According to this method $n = 7k+1, 7k+2$ and $7k+5$, so what's incorrect? We can find out all solutions by putting $k$ such that $0<n\leq 22$$ – Solus May 08 '23 at 20:29
-
Yes, maybe I misunderstand your meaning. What I mean is if $a(n)\cdot b(n)\equiv 1\pmod7$, it is not sufficient to say $a(n)=7k+1$ or $b(n)=7k+1$ – MathFail May 08 '23 at 20:51
-
@MathFail a(n) or b(n) should be of the given above forms (any of the above), or else it won't work, the modulus won't be 1. You shouldn't be able to find a counter-example to that. – rapidfire69 May 08 '23 at 20:56
-
@MathFail Wait what? Suppose 7 divides (n+1)(n+3), then wouldn't it mean that 7 divides (n+1) OR 7 divides (n+3)? Isn't this the same thing with a remainder of 1? – Solus May 08 '23 at 21:10
-
2@rapidfire69: I do not know why the downvotes, but probably because of the following step that needs further justification: "therefore we need to find $n = 7k+1$ or $n^3 = 7k+1$". Maybe I am too tired right now, but this logical jump is definitely not obvious to me. – Alex M. May 08 '23 at 21:37