We have your learning goals covered with Spring and Summer courses available. Enroll today!

G
Topic
First Poster
Last Poster
k a March Highlights and 2025 AoPS Online Class Information
jlacosta   0
Mar 2, 2025
March is the month for State MATHCOUNTS competitions! Kudos to everyone who participated in their local chapter competitions and best of luck to all going to State! Join us on March 11th for a Math Jam devoted to our favorite Chapter competition problems! Are you interested in training for MATHCOUNTS? Be sure to check out our AMC 8/MATHCOUNTS Basics and Advanced courses.

Are you ready to level up with Olympiad training? Registration is open with early bird pricing available for our WOOT programs: MathWOOT (Levels 1 and 2), CodeWOOT, PhysicsWOOT, and ChemWOOT. What is WOOT? WOOT stands for Worldwide Online Olympiad Training and is a 7-month high school math Olympiad preparation and testing program that brings together many of the best students from around the world to learn Olympiad problem solving skills. Classes begin in September!

Do you have plans this summer? There are so many options to fit your schedule and goals whether attending a summer camp or taking online classes, it can be a great break from the routine of the school year. Check out our summer courses at AoPS Online, or if you want a math or language arts class that doesn’t have homework, but is an enriching summer experience, our AoPS Virtual Campus summer camps may be just the ticket! We are expanding our locations for our AoPS Academies across the country with 15 locations so far and new campuses opening in Saratoga CA, Johns Creek GA, and the Upper West Side NY. Check out this page for summer camp information.

Be sure to mark your calendars for the following events:
[list][*]March 5th (Wednesday), 4:30pm PT/7:30pm ET, HCSSiM Math Jam 2025. Amber Verser, Assistant Director of the Hampshire College Summer Studies in Mathematics, will host an information session about HCSSiM, a summer program for high school students.
[*]March 6th (Thursday), 4:00pm PT/7:00pm ET, Free Webinar on Math Competitions from elementary through high school. Join us for an enlightening session that demystifies the world of math competitions and helps you make informed decisions about your contest journey.
[*]March 11th (Tuesday), 4:30pm PT/7:30pm ET, 2025 MATHCOUNTS Chapter Discussion MATH JAM. AoPS instructors will discuss some of their favorite problems from the MATHCOUNTS Chapter Competition. All are welcome!
[*]March 13th (Thursday), 4:00pm PT/7:00pm ET, Free Webinar about Summer Camps at the Virtual Campus. Transform your summer into an unforgettable learning adventure! From elementary through high school, we offer dynamic summer camps featuring topics in mathematics, language arts, and competition preparation - all designed to fit your schedule and ignite your passion for learning.[/list]
Our full course list for upcoming classes is below:
All classes run 7:30pm-8:45pm ET/4:30pm - 5:45pm PT unless otherwise noted.

Introductory: Grades 5-10

Prealgebra 1 Self-Paced

Prealgebra 1
Sunday, Mar 2 - Jun 22
Friday, Mar 28 - Jul 18
Sunday, Apr 13 - Aug 10
Tuesday, May 13 - Aug 26
Thursday, May 29 - Sep 11
Sunday, Jun 15 - Oct 12
Monday, Jun 30 - Oct 20
Wednesday, Jul 16 - Oct 29

Prealgebra 2 Self-Paced

Prealgebra 2
Tuesday, Mar 25 - Jul 8
Sunday, Apr 13 - Aug 10
Wednesday, May 7 - Aug 20
Monday, Jun 2 - Sep 22
Sunday, Jun 29 - Oct 26
Friday, Jul 25 - Nov 21


Introduction to Algebra A Self-Paced

Introduction to Algebra A
Sunday, Mar 23 - Jul 20
Monday, Apr 7 - Jul 28
Sunday, May 11 - Sep 14 (1:00 - 2:30 pm ET/10:00 - 11:30 am PT)
Wednesday, May 14 - Aug 27
Friday, May 30 - Sep 26
Monday, Jun 2 - Sep 22
Sunday, Jun 15 - Oct 12
Thursday, Jun 26 - Oct 9
Tuesday, Jul 15 - Oct 28

Introduction to Counting & Probability Self-Paced

Introduction to Counting & Probability
Sunday, Mar 16 - Jun 8
Wednesday, Apr 16 - Jul 2
Thursday, May 15 - Jul 31
Sunday, Jun 1 - Aug 24
Thursday, Jun 12 - Aug 28
Wednesday, Jul 9 - Sep 24
Sunday, Jul 27 - Oct 19

Introduction to Number Theory
Monday, Mar 17 - Jun 9
Thursday, Apr 17 - Jul 3
Friday, May 9 - Aug 1
Wednesday, May 21 - Aug 6
Monday, Jun 9 - Aug 25
Sunday, Jun 15 - Sep 14
Tuesday, Jul 15 - Sep 30

Introduction to Algebra B Self-Paced

Introduction to Algebra B
Sunday, Mar 2 - Jun 22
Wednesday, Apr 16 - Jul 30
Tuesday, May 6 - Aug 19
Wednesday, Jun 4 - Sep 17
Sunday, Jun 22 - Oct 19
Friday, Jul 18 - Nov 14

Introduction to Geometry
Tuesday, Mar 4 - Aug 12
Sunday, Mar 23 - Sep 21
Wednesday, Apr 23 - Oct 1
Sunday, May 11 - Nov 9
Tuesday, May 20 - Oct 28
Monday, Jun 16 - Dec 8
Friday, Jun 20 - Jan 9
Sunday, Jun 29 - Jan 11
Monday, Jul 14 - Jan 19

Intermediate: Grades 8-12

Intermediate Algebra
Sunday, Mar 16 - Sep 14
Tuesday, Mar 25 - Sep 2
Monday, Apr 21 - Oct 13
Sunday, Jun 1 - Nov 23
Tuesday, Jun 10 - Nov 18
Wednesday, Jun 25 - Dec 10
Sunday, Jul 13 - Jan 18
Thursday, Jul 24 - Jan 22

Intermediate Counting & Probability
Sunday, Mar 23 - Aug 3
Wednesday, May 21 - Sep 17
Sunday, Jun 22 - Nov 2

Intermediate Number Theory
Friday, Apr 11 - Jun 27
Sunday, Jun 1 - Aug 24
Wednesday, Jun 18 - Sep 3

Precalculus
Sunday, Mar 16 - Aug 24
Wednesday, Apr 9 - Sep 3
Friday, May 16 - Oct 24
Sunday, Jun 1 - Nov 9
Monday, Jun 30 - Dec 8

Advanced: Grades 9-12

Olympiad Geometry
Wednesday, Mar 5 - May 21
Tuesday, Jun 10 - Aug 26

Calculus
Sunday, Mar 30 - Oct 5
Tuesday, May 27 - Nov 11
Wednesday, Jun 25 - Dec 17

Group Theory
Thursday, Jun 12 - Sep 11

Contest Preparation: Grades 6-12

MATHCOUNTS/AMC 8 Basics
Sunday, Mar 23 - Jun 15
Wednesday, Apr 16 - Jul 2
Friday, May 23 - Aug 15
Monday, Jun 2 - Aug 18
Thursday, Jun 12 - Aug 28
Sunday, Jun 22 - Sep 21
Tues & Thurs, Jul 8 - Aug 14 (meets twice a week!)

MATHCOUNTS/AMC 8 Advanced
Friday, Apr 11 - Jun 27
Sunday, May 11 - Aug 10
Tuesday, May 27 - Aug 12
Wednesday, Jun 11 - Aug 27
Sunday, Jun 22 - Sep 21
Tues & Thurs, Jul 8 - Aug 14 (meets twice a week!)

AMC 10 Problem Series
Tuesday, Mar 4 - May 20
Monday, Mar 31 - Jun 23
Friday, May 9 - Aug 1
Sunday, Jun 1 - Aug 24
Thursday, Jun 12 - Aug 28
Tuesday, Jun 17 - Sep 2
Sunday, Jun 22 - Sep 21 (1:00 - 2:30 pm ET/10:00 - 11:30 am PT)
Monday, Jun 23 - Sep 15
Tues & Thurs, Jul 8 - Aug 14 (meets twice a week!)

AMC 10 Final Fives
Sunday, May 11 - Jun 8
Tuesday, May 27 - Jun 17
Monday, Jun 30 - Jul 21

AMC 12 Problem Series
Tuesday, May 27 - Aug 12
Thursday, Jun 12 - Aug 28
Sunday, Jun 22 - Sep 21
Wednesday, Aug 6 - Oct 22

AMC 12 Final Fives
Sunday, May 18 - Jun 15

F=ma Problem Series
Wednesday, Jun 11 - Aug 27

WOOT Programs
Visit the pages linked for full schedule details for each of these programs!


MathWOOT Level 1
MathWOOT Level 2
ChemWOOT
CodeWOOT
PhysicsWOOT

Programming

Introduction to Programming with Python
Monday, Mar 24 - Jun 16
Thursday, May 22 - Aug 7
Sunday, Jun 15 - Sep 14 (1:00 - 2:30 pm ET/10:00 - 11:30 am PT)
Tuesday, Jun 17 - Sep 2
Monday, Jun 30 - Sep 22

Intermediate Programming with Python
Sunday, Jun 1 - Aug 24
Monday, Jun 30 - Sep 22

USACO Bronze Problem Series
Tuesday, May 13 - Jul 29
Sunday, Jun 22 - Sep 1

Physics

Introduction to Physics
Sunday, Mar 30 - Jun 22
Wednesday, May 21 - Aug 6
Sunday, Jun 15 - Sep 14
Monday, Jun 23 - Sep 15

Physics 1: Mechanics
Tuesday, Mar 25 - Sep 2
Thursday, May 22 - Oct 30
Monday, Jun 23 - Dec 15

Relativity
Sat & Sun, Apr 26 - Apr 27 (4:00 - 7:00 pm ET/1:00 - 4:00pm PT)
Mon, Tue, Wed & Thurs, Jun 23 - Jun 26 (meets every day of the week!)
0 replies
jlacosta
Mar 2, 2025
0 replies
k i Adding contests to the Contest Collections
dcouchman   1
N Apr 5, 2023 by v_Enhance
Want to help AoPS remain a valuable Olympiad resource? Help us add contests to AoPS's Contest Collections.

Find instructions and a list of contests to add here: https://artofproblemsolving.com/community/c40244h1064480_contests_to_add
1 reply
dcouchman
Sep 9, 2019
v_Enhance
Apr 5, 2023
k i Zero tolerance
ZetaX   49
N May 4, 2019 by NoDealsHere
Source: Use your common sense! (enough is enough)
Some users don't want to learn, some other simply ignore advises.
But please follow the following guideline:


To make it short: ALWAYS USE YOUR COMMON SENSE IF POSTING!
If you don't have common sense, don't post.


More specifically:

For new threads:


a) Good, meaningful title:
The title has to say what the problem is about in best way possible.
If that title occured already, it's definitely bad. And contest names aren't good either.
That's in fact a requirement for being able to search old problems.

Examples:
Bad titles:
- "Hard"/"Medium"/"Easy" (if you find it so cool how hard/easy it is, tell it in the post and use a title that tells us the problem)
- "Number Theory" (hey guy, guess why this forum's named that way¿ and is it the only such problem on earth¿)
- "Fibonacci" (there are millions of Fibonacci problems out there, all posted and named the same...)
- "Chinese TST 2003" (does this say anything about the problem¿)
Good titles:
- "On divisors of a³+2b³+4c³-6abc"
- "Number of solutions to x²+y²=6z²"
- "Fibonacci numbers are never squares"


b) Use search function:
Before posting a "new" problem spend at least two, better five, minutes to look if this problem was posted before. If it was, don't repost it. If you have anything important to say on topic, post it in one of the older threads.
If the thread is locked cause of this, use search function.

Update (by Amir Hossein). The best way to search for two keywords in AoPS is to input
[code]+"first keyword" +"second keyword"[/code]
so that any post containing both strings "first word" and "second form".


c) Good problem statement:
Some recent really bad post was:
[quote]$lim_{n\to 1}^{+\infty}\frac{1}{n}-lnn$[/quote]
It contains no question and no answer.
If you do this, too, you are on the best way to get your thread deleted. Write everything clearly, define where your variables come from (and define the "natural" numbers if used). Additionally read your post at least twice before submitting. After you sent it, read it again and use the Edit-Button if necessary to correct errors.


For answers to already existing threads:


d) Of any interest and with content:
Don't post things that are more trivial than completely obvious. For example, if the question is to solve $x^{3}+y^{3}=z^{3}$, do not answer with "$x=y=z=0$ is a solution" only. Either you post any kind of proof or at least something unexpected (like "$x=1337, y=481, z=42$ is the smallest solution). Someone that does not see that $x=y=z=0$ is a solution of the above without your post is completely wrong here, this is an IMO-level forum.
Similar, posting "I have solved this problem" but not posting anything else is not welcome; it even looks that you just want to show off what a genius you are.

e) Well written and checked answers:
Like c) for new threads, check your solutions at least twice for mistakes. And after sending, read it again and use the Edit-Button if necessary to correct errors.



To repeat it: ALWAYS USE YOUR COMMON SENSE IF POSTING!


Everything definitely out of range of common sense will be locked or deleted (exept for new users having less than about 42 posts, they are newbies and need/get some time to learn).

The above rules will be applied from next monday (5. march of 2007).
Feel free to discuss on this here.
49 replies
ZetaX
Feb 27, 2007
NoDealsHere
May 4, 2019
Finally hard NT on UKR MO from NT master
mshtand1   3
N 6 minutes ago by Jupiterballs
Source: Ukrainian Mathematical Olympiad 2025. Day 1, Problem 11.4
A pair of positive integer numbers \((a, b)\) is given. It turns out that for every positive integer number \(n\), for which the numbers \((n - a)(n + b)\) and \(n^2 - ab\) are positive, they have the same number of divisors. Is it necessarily true that \(a = b\)?

Proposed by Oleksii Masalitin
3 replies
mshtand1
Mar 13, 2025
Jupiterballs
6 minutes ago
Inspired by my own results
sqing   2
N 16 minutes ago by lbh_qys
Source: Own
Let $ a,b,c\geq 2.$ Prove that
$$ (a+1)(b+2)(c +1)-3 abc\leq 12$$$$ (a+1)(b+2)(c +1)-\frac{7}{2}abc\leq  8$$$$ (a+1)(b+3)(c +1)-\frac{15}{4}abc\leq  15$$$$ (a+1)(b+3)(c +1)-4abc\leq  13$$
2 replies
sqing
2 hours ago
lbh_qys
16 minutes ago
Function Equation
Dynic   0
18 minutes ago
Find all $f:\mathbb{R} \to \mathbb{R}$ such that
$$f(x-f(y))=f(x+f(y)+y^5)+f(2f(y)+y^5)+2025,\forall x,y\in \mathbb{R}$$
0 replies
1 viewing
Dynic
18 minutes ago
0 replies
Cubic function from Olymon
Adywastaken   0
an hour ago
Source: Olymon Volume 11 2010 663
Find all $f:\mathbb{R}\rightarrow\mathbb{R}$ such that
$x^2y^2(f(x+y)-f(x)-f(y))=3(x+y)f(x)f(y)$ $\forall$ $x,y \in \mathbb{R}$
0 replies
+1 w
Adywastaken
an hour ago
0 replies
Sequence bounding itself
juckter   2
N an hour ago by Math-Problem-Solving
Source: Own
We say a sequence of integers $a_1, a_2, \dots, a_n$ is self-bounded if for each $i$, $1 \le i \le n$ there exist at least $a_i$ terms of the sequence that are less than or equal to $i$. Find the maximum possible value of $a_1 + a_2 + \dots + a_n$ for a self-bounded sequence $a_1, a_2, \dots, a_n$.
2 replies
juckter
Jan 13, 2021
Math-Problem-Solving
an hour ago
Checkerboard
Ecrin_eren   0
an hour ago
On an 8×8 checkerboard, what is the minimum number of squares that must be marked (including the marked ones) so that every square has exactly one marked neighbor? (We define neighbors as squares that share a common edge, and a square is not considered a neighbor of itself.)
0 replies
Ecrin_eren
an hour ago
0 replies
An inequality
JK1603JK   3
N an hour ago by lbh_qys
Source: unknown
Let a,b,c>=0: ab+bc+ca=3 then maximize P=\frac{a^2b+b^2c+c^2a+9}{a+b+c}+\frac{abc}{2}.
3 replies
+1 w
JK1603JK
Yesterday at 10:28 AM
lbh_qys
an hour ago
Find (a,n)
shobber   70
N 2 hours ago by cherry265
Source: China TST 2006 (1)
Find all positive integer pairs $(a,n)$ such that $\frac{(a+1)^n-a^n}{n}$ is an integer.
70 replies
shobber
Mar 24, 2006
cherry265
2 hours ago
FE with 2 degrees
Adywastaken   2
N 2 hours ago by Adywastaken
Source: Serbia 2021/5
Find all $f:\mathbb{R}\rightarrow\mathbb{R}$ such that $f(xf(y)+x^2+y)=f(x)f(y)+xf(x)+f(y) \forall x,y \in \mathbb{R}$
2 replies
Adywastaken
Yesterday at 12:29 PM
Adywastaken
2 hours ago
keep one card and discard the other
Scilyse   2
N 2 hours ago by flower417477
Source: CGMO 2024 P2
There are $8$ cards on which the numbers $1$, $2$, $\dots$, $8$ are written respectively. Alice and Bob play the following game: in each turn, Alice gives two cards to Bob, who must keep one card and discard the other. The game proceeds for four turns in total; in the first two turns, Bob cannot keep both of the cards with the larger numbers, and in the last two turns, Bob also cannot keep both of the cards with the larger numbers. Let $S$ be the sum of the numbers written on the cards that Bob keeps. Find the greatest positive integer $N$ for which Bob can guarantee that $S$ is at least $N$.
2 replies
Scilyse
Jan 28, 2025
flower417477
2 hours ago
JBMO Shortlist 2020 N4
Lukaluce   6
N 2 hours ago by Assassino9931
Source: JBMO Shortlist 2020
Find all prime numbers $p$ such that

$(x + y)^{19} - x^{19} - y^{19}$

is a multiple of $p$ for any positive integers $x$, $y$.
6 replies
1 viewing
Lukaluce
Jul 4, 2021
Assassino9931
2 hours ago
Existence in number theory
shangyang   5
N 2 hours ago by shanelin-sigma
Prove that there are infinitely many integers can't be written as $$\frac{p^a-p^b}{p^c-p^d}$$, with a,b,c,d are arbitrary integers and p is an arbitrary prime such that the fraction is an integer too.
5 replies
shangyang
Nov 26, 2021
shanelin-sigma
2 hours ago
Interesting inequality
sqing   1
N 3 hours ago by sqing
Source: Own
Let $ a,b,c\geq 2.$ Prove that
$$ (a+1)(b+1)(c +1)-\frac{9}{4}abc\leq 9$$$$ (a+2)(b+2)(c +2)-4 abc\leq 32$$$$ (a+2)(b+2)(c +2)-\frac{17}{4}a b c\leq 30$$$$ (a+1)(b+1)(c +1)-\frac{23}{10}abc\leq\frac{43}{5}$$
1 reply
sqing
4 hours ago
sqing
3 hours ago
All Russian Olympiad 2018 Day1 P2
Davrbek   23
N 3 hours ago by Marcus_Zhang
Source: Grade 11 P2
Let $n\geq 2$ and $x_{1},x_{2},\ldots,x_{n}$ positive real numbers. Prove that
\[\frac{1+x_{1}^2}{1+x_{1}x_{2}}+\frac{1+x_{2}^2}{1+x_{2}x_{3}}+\cdots+\frac{1+x_{n}^2}{1+x_{n}x_{1}}\geq n.\]
23 replies
Davrbek
Apr 28, 2018
Marcus_Zhang
3 hours ago
IMO Shortlist 2013, Algebra #5
lyukhson   33
N Mar 17, 2025 by HamstPan38825
Source: IMO Shortlist 2013, Algebra #5
Let $\mathbb{Z}_{\ge 0}$ be the set of all nonnegative integers. Find all the functions $f: \mathbb{Z}_{\ge 0} \rightarrow \mathbb{Z}_{\ge 0} $ satisfying the relation
\[ f(f(f(n))) = f(n+1 ) +1 \]
for all $ n\in \mathbb{Z}_{\ge 0}$.
33 replies
lyukhson
Jul 9, 2014
HamstPan38825
Mar 17, 2025
IMO Shortlist 2013, Algebra #5
G H J
Source: IMO Shortlist 2013, Algebra #5
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
lyukhson
127 posts
#1 • 7 Y
Y by doxuanlong15052000, megarnie, Adventure10, Mango247, and 3 other users
Let $\mathbb{Z}_{\ge 0}$ be the set of all nonnegative integers. Find all the functions $f: \mathbb{Z}_{\ge 0} \rightarrow \mathbb{Z}_{\ge 0} $ satisfying the relation
\[ f(f(f(n))) = f(n+1 ) +1 \]
for all $ n\in \mathbb{Z}_{\ge 0}$.
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
alibez
358 posts
#2 • 5 Y
Y by megarnie, Adventure10, and 3 other users
lyukhson wrote:
Let $\mathbb{Z}_{\ge 0}$ be the set of all nonnegative integers. Find all the functions $f: \mathbb{Z}_{\ge 0} \rightarrow \mathbb{Z}_{\ge 0} $ satisfying the relation
\[ f(f(f(n))) = f(n+1 ) +1 \]
for all $ n\in \mathbb{Z}_{\ge 0}$.


nice problem but have usual idea !

hint
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
tash
45 posts
#3 • 5 Y
Y by benpigchu, megarnie, Adventure10, and 2 other users
Here is a related lemma

Lemma:
Let $ f:\mathbb{Z}_{\ge 0}\rightarrow\mathbb{Z}_{\ge 0} $ is such that $f^{(k)}(n)=n+a$.
Prove that
    1.
$a$ divides $k$

2. The set $\{0,1,\ldots, a-1\}$ can be partitioned into tuples $(r_1, r_2,\ldots, r_k)$ such that
\[
f(r_1)=r_2, f(r_2)=r_3, \ldots, f(r_{k-1})=r_k, f(r_k)=r_1+a.
\]

3. $ f^{(i)}(0)+\ldots+ f^{(i)}(a-1)=1+2+\dots+(a-1)+\frac{a^2}{k}i$


One can note that the function in the problem satisfies $f^{(4)}(n)=n+a$ and also for $g(n)=f(n)+1, $ $g^{(2)}(n)=n+a.$ Using the lemma it is not hard to get $a=4$ and to find the only two solutions:
    1.
$f(n)=n+1$

2. $f(n)=\begin{cases}n+1,\ n=2k\\
n+5,\ n=4k+1\\
n-3,\ n=4k+3
\end{cases}$

This post has been edited 1 time. Last edited by tash, Jul 10, 2014, 10:35 PM
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
mathuz
1510 posts
#4 • 6 Y
Y by megarnie, Adventure10, Mango247, and 3 other users
The idea of the problem:

$g(n)=f(n+1)-1$ is also solution.
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
JuanOrtiz
366 posts
#5 • 6 Y
Y by MathbugAOPS, Phie11, qubatae, megarnie, Adventure10, Mango247
Let $f^m(n)$ be $f$ iterated on $n$, $m$ times. Let the problem assertion be $P(n)$. Then for $n>0$, from $P(f(n))$ and $P(n-1)$ we get that

$f^4(n-1)+1=f(f^3(n-1))+1=f(f(n)+1)+1=f^4(n)$

for all $n>0$, and so $\boxed{f^4(n)=n+c}$ for all $n$ and a constant $c$. From this, $f$ is inyective. We get $f(n+c)=f(f^4(n))=f^5(n)=f(n)+c$, so $\boxed{f(n+c)=f(n)+c}$.

From this, we can consider $f$ as an injective function in $\mathbb{Z}_c$ which, if iterated four times, gives the identity. Notice that, for any $n$, the numbers $n,f(n),f^2(n),f^3(n)$ are all distinct in $\mathbb{Z}_c$. Indeed

Therefore, we can write $\mathbb{Z}_c$ as a union of disjoint sets of the form $X_n = \{ n, f(n), f^2(n), f^3(n) \}$. This is a partition. (Note that this implies $4 | c$). Let $g : \mathbb{Z}_c \rightarrow \mathbb{Z}$ be a function where $g(n)=f(n)-n$. Then $\sum_{m \in X_n} g(m) = c$. Therefore, if we choose $m$ randomly and uniformly in $\mathbb{Z}_c$, $\mathrm{E}[g(m)]=\frac{c}{4}$.

Notation Notice that if we choose $m$ randomly and uniformly in $\mathbb{Z}_c$, then we are choosing $(m+1) \bmod c$ also randomly and uniformly, so $f(m+1) \bmod c$ is also random and uniform (since it is not hard to verify $f$ is a bijection in $\mathbb{Z}_c$), and so $f(m+1)+1 \bmod c$ is also like this. Also note $f(f(m+1)+1)=f(f^3(m))=f^4(m)=m+c$. Therefore, because of linearity of expectation,

$\frac{c}{4} = \mathrm{E}[f(f(m+1)+1)-(f(m+1)+1)] = \mathrm{E}[m+c-(f(m+1)+1)] = \mathrm{E}[(m+1)-f(m+1)] + \mathrm{E}[c-2] = -\frac{c}{4}+(c-2)$

and therefore $\boxed{c=4}$.

And so $f(n+4)=f(n)+4$ so we only need to find $f(0),f(1),f(2),f(3)$ to finish.

Divide $\mathbb{N}_0$ into sets of size $4$: $\{0,1,2,3\}, \{4,5,6,7\}, \ldots$. Call these sets $4-sets$. If $f(n)=m$ where $m$ is in a previous $4-set$ than $n$, we conclude that $f(n \bmod 4)<0$, contradiction. If $f(n)=m$ where $m$ is two $4-sets$ advanced from $n$, then because of the previous rule, we conclude $f^4(n)>n+4$, contradiction. Therefore, $0 \le f(i) \le 7$ for $i=0,1,2,3$.

Now we just do the casework (which I will not write here because it's just casework, nothing interesting) and obtain two solutions: $\boxed{f(n)=n+1}$ and the following convoluted one:

$\boxed{f(4k)=4k+1,f(4k+1)=4k+6,f(4k+2)=4k+3,f(4k+3)=4k}$ for all $k \ge 0$.
What?!

Done.
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
LyLeanChea
7 posts
#6 • 2 Y
Y by Adventure10, Mango247
have any solution? haha
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
LyLeanChea
7 posts
#7 • 3 Y
Y by megarnie, Adventure10, Mango247
I need another solution for this problem .
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
fclvbfm934
759 posts
#8 • 2 Y
Y by Adventure10, Mango247
Note: I will refer to $f^k(x)$ to mean $f$ composed $k$ times. So $f^2(x) = f(f(x))$. The FE can now be stated as $f^3(n) = f(n+1) + 1$.

Taking $f$ of both sides yields
$$f^4(n) = f(f(n)+1) + 1 = f(f(n+1)+1) = f^3(f(n+1)) - 1$$So therefore we see that $f^4(n) + 1 = f^4(n+1)$. It therefore follows that $f^4(n) = n+c$ where $c = f^4(0)$.

We will prove that $f$ is injective. Suppose $f(x) = f(y)$. That means $c+x = f^4(x) = f^4(y) = c+y$ and so $x = y$. We can now be certain that $f^{-1}$ exists (the inverse). We can also establish an important relationship by considering $f^4(n) = n+c$. Take $f$ of both sides to get $f^5(n) = f(n+c) = f^4(f(n)) = f(n) + c$. We now break into two cases.

Case 1: $c \neq 0$:

Notice that we care about the inputs mod $c$, because $f(n+c) = f(n) + c$. Let us first prove that $n, f(n), f^2(n), f^3(n)$ are distinct modulo $c$. Suppose $n \equiv f(n) \pmod{c}$. That would get us into trouble because that means $f(n) = n+kc$ and would yield $f^4(n) = n+4kc$, contradiction. Similarly, if $f^2(n) \equiv n \pmod{c}$, we would get $f^4(n) = n+2kc$ for some $k$. So therefore, each of those must be distinct. I will define the term class to mean a set $n, f(n), f^2(n), f^3(n)$. It is also obvious that these classes have to be mutually exclusive. Note that this easily implies $4|c$. Now let's add!
Adding part, which takes up lots of space
Now that we get $c = 4$, we can do some bashing. We want to analyze $f(0), f(1), f(2), f(3)$ but this is easy. Bash through and we get $(1, 2, 3, 4)$ or $(1, 6, 3, 0)$ which is weird but whatever.

Case 2: $c = 0$.

This means $f^4(n) = n$. This means $f^{-1}(n) = f(n+1) + 1$. This means $f^2(n) = f(f(n+1) + 2) + 1$. Then, plug in $n = f(0)$ which is then $0 = f(f(0)+1) + 1$ which is impossible. Sadly, this part took me the longest :(
This post has been edited 1 time. Last edited by fclvbfm934, Apr 5, 2016, 8:24 AM
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
Aditya_43
7 posts
#9 • 2 Y
Y by Adventure10, Mango247
$$f^4(n) = f(f(n)+1) + 1 = f(f(n+1)+1) = f^3(f(n+1)) - 1$$Where do you get " f(f(n)+1) + 1 " ?
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
mathcool2009
352 posts
#10 • 2 Y
Y by Adventure10, Mango247
N.B. $h^n(x)$ will always denote $h$ composed with itself $n$ times (as opposed to $h$ raised to the $n$th power).

Obviously $f(n) = n+1$ is a solution. It is easy to verify that $f(0) = 1, f(1) = 6, f(2) = 3, f(3) = 0, f(n+4) = f(n)+4$ is also a solution. We will show that these are the only solutions for $f$.

Rewrite the condition as $f^3(n) = f(n+1)+1$.

Lemma 1. $f(f(n)+1) = n+c$ for some constant $c \ge 0$.

Proof. Note that $f^3(f(n)) = f(f^3(n))$; accordingly, we have $f(f(n)+1)+1 = f(f(n+1)+1)$ for all $n \in \mathbb{Z}_{\ge 0}$. Thus $f(f(n)+1)$ is linear in $n$ and we have $f(f(n)+1) = n + f(f(0)+1)$. Letting $c = f(f(0)+1)$, the result follows. $\blacksquare$

Corollary 1. $g^2(n) = n+c+1$, where $g(n)$ denotes $f(n)+1$.

Corollary 2. $f$ is surjective over $[c, +\infty)$.

Lemma 2. $f^4(n) = n+c+1$

Proof. Simply note that $f^4(n) = f^3(f(n)) = f(f(n)+1)+1 = n+c+1$. $\blacksquare$

Lemma 3. $f(m+c+1) = f(m)+c+1$ for all $m \in \mathbb{Z}_{\ge 0}$

Proof. Plug in $n = f(m)+1$ into Lemma 1. We get $f(f(f(m)+1)+1) = f(m)+c+1$. Since the LHS equals $f(m+c+1)$, the result follows. $\blacksquare$

Corollary. If $n = y(c+1)+z$ where $y,z$ are integers and $0 \le z < c+1$, we have $f(n) = y(c+1) + f(z)$.

Lemma 4. $f$ is injective.

Proof. Suppose not; i.e. $f(a) = f(b)$ for some $a<b$. Note that $f(a) = f(b)$ implies $f^3(a) = f^3(b)$ and so $f(a+1) = f(b+1)$. Thus $f(a+n) = f(b+n)$ for all $n \ge 0$; i.e. $f$ is eventually periodic, contradicting Lemma 3. $\blacksquare$

Corollary. $g$ is injective.

Now we are ready to do the problem. We will use Lemma 2 and the Corollary 1 to Lemma 1. The basic idea is to look at \[ S = \sum_{n=0}^{c} (f(n) - n) \]and to express this in two different ways. On the one hand, since $f^4(n) = n+c+1$, we have $n,f(n), f(f(n)), f(f(f(n)))$ are distinct modulo $n+c+1$. Thus we have \[S = \frac{1}{4} \sum_{n=0}^{c} ((f(n)-n) + (f^2(n) - f(n)) + (f^3(n) - f^2(n)) + (f^4(n) - f^3(n))) = \frac{1}{4}(c+1)^2. \]On the other hand, since $g^2(n) = n+c+1$, we have $n, g(n)$ are distinct modulo $n+c+1$. Thus we have \[ S = - (c+1) + \sum_{n=0}^{c} (g(n)-n) = -(c+1) + \frac{1}{2}\sum_{n=0}^{c}((g(n) - n) + (g^2(n) - g(n))) = -(c+1) + \frac{1}{2}(c+1)^2 . \]We have \[ \frac{1}{4}(c+1)^2 = -(c+1) + \frac{1}{2}(c+1)^2\]and thus \[ c = 3. \]
Now it's not hard to finish. Note that $f(0), f(1), f(2), f(3)$ completely determine $f$. Note that $3 = f(f(0)+1)$, so we must have $f(0) + 1 \le 3$ (otherwise $f(f(0)-3) = -1$, contradiction). Thus $g(0) \le 3$. If $g(0) = 3$, we have $g(3) = 4$, so $f(3) = 3$, contradicting Lemma 2. Similarly, if $g(0) = 1$, we have $f(0) = 0$, contradicting Lemma 2. Thus $g(0) = 2$ and $g(2) = 4$; these imply $f(0) = 1$ and $f(2) = 3$. Now $f$ is surjective over $[3, +\infty)$ so $f(1), f(3) \le 6$. The possibilities for $(f(1), f(3))$ are \[ (0,2), (0,6),(4,2),(4,6), (2,0), (2,4), (6,0), (6,4). \]Checking all of these, we see that the first five cases violate Lemma 2, the sixth case produces the solution $f(n) = n+1$, the seventh case produces the solution $f(0) = 1, f(1) = 6, f(2) = 3, f(3) = 0, f(n+4) = f(n)+4$, and the eighth case violates injectivity. $\blacksquare$
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
navi_09220114
461 posts
#11 • 2 Y
Y by Adventure10, Mango247
The answer is $f_1(n)=n+1$, and $f_2(n)=n+1$ for $n\equiv 0\pmod 2$, $f_2(n)=n+5$ for $n\equiv 1\pmod 4$, and $f_2(n)=n-3$ for $n\equiv 3\pmod 4$.

First we have $f(f(n+1)+1)=f^4(n)=f(f(n)+1)+1$, so define $g(n)=f(f(n)+1)$ gives $g(n+1)=g(n)+1\Rightarrow g(n)=n+g(0)$. So $f^4(n)=g(n+1)=n+g(0)+1$. Let $k=g(0)+1\ge 1$, and $h(n)=f(n)+1$, then $h(h(n))=f(f(n)+1)=n+k$. Note that $h(n+k)=h(h(h(n)))=h(n)+k$. If $f(i)\equiv i \pmod k$, then for any $\ell \in \mathbb{Z}$, $h(i)=i+\ell k\Rightarrow i+k=h(h(i))=h(i+\ell k)=h(i)+\ell k=i+2\ell k \Rightarrow 2\ell =1$ which is is impossible, so for all $0\le i\le k-1$, we have $h(i)=mk+j$ for some $m\in \mathbb{Z}_{\ge 0}$ and $0\le j \le k-1$. If $m\ge 2$ for some $0\le i\le k-1$, then $i+k=h(h(i))=h(mk+j)=h((m-2)k+j)+2k \Rightarrow h((m-2)k+j)=i-k<0$, which is also impossible, so $m\le 1$. Now for all $0\le i,j\le k-1$, $i\neq j$, if $h(i)=j$ then $h(j)=h(h(i))=i+k$, otherwise if $h(i)=k+j$ then $h(j)=h(j+k)-k=h(h(i))-k=i$. In particular, all residues of $k$ can be paired up into pairs $(i,j)$ so that $h(i)\equiv j\pmod k$ and $h(j)\equiv i\pmod k$. So $k$ must be even. Define a residue $i \in \{0,1,\cdots, k-1\}$ to be good if $h(i)=k+j$ and bad if $h(i)=j$ otherwise, for some other residue $j\neq i$. Consider the quantity $$S=\sum^{k-1}_{n=0} h(n+1)=\sum^{k-1}_{n=0} f^3(n)$$Note that if $(i,j)$ is a pair then exactly one of $i$ and $j$ is good, so $h(i)+h(j)=i+j+k \Rightarrow f(i)+f(j)=i+j+k-2$. Furthermore for any $a,b\in \mathbb{Z}_{\ge 0}$, $h(ak+i)+h(bk+j)=ak+h(i)+bk+h(j)=(ak+i)+(bk+j)+k \Rightarrow f(ak+i)+f(bk+j)=(ak+i)+(bk+j)+k-2$. Note that $m\equiv n \pmod k \iff h(m)\equiv h(n)\pmod k \iff f(m)\equiv f(n)\pmod k$, so $\{f^\ell(0), f^\ell(1), \cdots, f^\ell(k-1)\}$ is a complete set of residues modulo $k$ for every $\ell\in \mathbb{N}$. Thus $$S=\sum^{k-1}_{n=0} h(n+1)=\sum^{k-1}_{n=1} h(n)+h(k)=\sum^{k-1}_{n=0} h(n)+k=\sum^{k-1}_{n=0}n+ k(\frac{k}{2})+k$$While we also have $$S=\sum^{k-1}_{n=0}f^3(n)=\sum^{k-1}_{n=0}f^2(n)+(k-2)(\frac{k}{2})=\sum^{k-1}_{n=0}f(n)+2(k-2)(\frac{k}{2})=\sum^{k-1}_{n=0}n+3(k-2)(\frac{k}{2})$$Compare both sides we deduce $k=4$, since $k=g(0)+1\ge 1$.

So we have $h(n+4)=h(n)+4 \Rightarrow f(n+4)=f(n)+4$. First, if $0\le i\le 3$ has $h(i)\equiv 0\pmod 4$, then $h(i)=0$ or $h(i)=4$. But $h(i)\neq 0$ otherwise $f(i)=-1$ which is false. So $h(i)=4$. If $i=1$ then $h(1)=4\Rightarrow h(0)=1 \Rightarrow f(0)=0 \Rightarrow 0=f^3(0)=h(1)=4$, false. If $i=3$ then $h(3)=4 \Rightarrow f(3)=3, h(0)=3 \Rightarrow h(4)=7 \Rightarrow 3=f^3(3)=h(4)=7$, false. So $i=2$ and so $h(2)=4\Rightarrow h(0)=2$. So $f(0)=1, f(2)=3$, and so we have $1$ and $3$ are the other pair of residues. If $1$ is bad then $h(1)=3$, then $h(3)=5$, so we get $f(1)=2, f(3)=4$. This gives $f(n)=n+1$ for all $0\le n \le 3$, and hence for all $n\in \mathbb{Z}_{\ge 0}$. Check, we get $n+3=(n+2)+1$, which does works. Otherwise $1$ is good, then $h(1)=7$, then $h(3)=1$, so we get $f(1)=6, f(3)=0$. Check the with the original equation modulo $4$: $f^3(0)=f^2(1)=f(6)=7=f(1)+1$, $f^3(1)=f^2(6)=f(7)=4=f(2)+1$, $f^3(2)=f^2(3)=f(0)=1=f(3)+1$, $f^3(3)=f^2(0)=f(1)=6=f(4)+1$, which is indeed a solution. So we get the desired solution set. $\blacksquare$
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
Taha1381
816 posts
#12 • 2 Y
Y by Adventure10, Mango247
mathcool2009 wrote:
N.B.

$n,f(n), f(f(n)), f(f(f(n)))$ are distinct modulo $n+c+1$. Thus we have \[S = \frac{1}{4} \sum_{n=0}^{c} ((f(n)-n) + (f^2(n) - f(n)) + (f^3(n) - f^2(n)) + (f^4(n) - f^3(n))) = \frac{1}{4}(c+1)^2. \]

Can somebody explain this part?
This post has been edited 1 time. Last edited by Taha1381, Jan 10, 2018, 10:04 AM
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
Taha1381
816 posts
#16 • 2 Y
Y by Adventure10, Mango247
Taha1381 wrote:
mathcool2009 wrote:
N.B.

$n,f(n), f(f(n)), f(f(f(n)))$ are distinct modulo $n+c+1$. Thus we have \[S = \frac{1}{4} \sum_{n=0}^{c} ((f(n)-n) + (f^2(n) - f(n)) + (f^3(n) - f^2(n)) + (f^4(n) - f^3(n))) = \frac{1}{4}(c+1)^2. \]

Can somebody explain this part?

OK I got it using the original solution here:

https://www.imo-official.org/problems/IMO2013SL.pdf
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
Taha1381
816 posts
#17 • 2 Y
Y by Adventure10, Mango247
Anyway what was the motivation?(For the second solution.)
This post has been edited 1 time. Last edited by Taha1381, Jan 13, 2018, 11:28 AM
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
tastymath75025
3223 posts
#18 • 3 Y
Y by Phie11, TechnoLenzer, Adventure10
Here's a pretty different solution from the above. For any set $S\subseteq \mathbb Z_{\ge 0}$, let $f(S)$ be the image of $S$. Let $Z=\mathbb Z_{\ge 0}$ for convenience. For $a,b\in Z$, let $[a,b] = \{a,a+1, \dots, b\}$ and $[a,\infty) = \{a,a+1, \dots \}$ (so if $a>b$, this set is empty).

First, note that $f(f(n+1) + 1) = f^4 (n) = f^3 (f(n)) = f(f(n) + 1) +1$. It then follows from iteration that $f(f(m) + 1) = f(f(n) + 1) + (m-n)$, so $f(m)=f(n)\implies m=n$, so $f$ is injective.

Next supppose $n>0$, so $f(n) + 1 = f^3 (n-1)$. It follows that whenever $m\in f(Z), m\neq f(0)$, we have that $m+1\in f(Z)$. It follows that we can split $f(Z)$ into the union of two disjoint intervals $[a, f(0)]\cup [b, \infty)$ for $a\le f(0), b>f(0)$. Now note that $f^3(Z)$ is precisely the set of values $f(1)+1, f(2)+1, \dots$, so $f^3(Z) = [a+1, f(0)] \cup [b+1, \infty)$. Let $S = Z\backslash f(Z)$, so from the injectivity of $f$ it follows that $\{a,b\} = f(Z)\backslash f^3(Z) = f(S) \cup f^2(S)$. Again by injectivity, $f(S)\cup f^2(S) = \emptyset$ and $|S|=|f(S)| = |f^2(S)|$, so comparing magnitudes yields $|S|=1$, meaning we can just let $S=\{c\}$ for some $c\in Z$.

We now have two cases. The first case is that $c=0$, so $f(Z) = [1,\infty)$, so $f(Z) = [a,f(0)] \cup [b,\infty)$, where $a=1,b=f(0)+1$. Then clearly $\{a,b\} = \{ f(c), f^2(c)\}$ in some order. In one case we have $f(c) = b\implies f(0) = f(0)+1$, contradiction, so we must have the other case, meaning $f(c)=a, f(a)=b\implies f(0)=1, f(1) = 2$. Now we induct on $n$ to show $f(n)=n+1$, with base cases $n=0,1$ obvious. For the inductive step, we note $f^3 (n-2) = f(n-1) +1\implies (n-1) + 1 + 1 = f^3 (n-2) = f^2(n-1)=f(n)$, as desired.

The second case is that $c>0$, in which case since $f(Z) = [a,f(0)]\cup [b,\infty)$ it follows that $c=f(0)+1, a=0, b=f(0)+2 =c+1$. Then once again we have $\{ f(c), f^2(c)\} = \{a,b\} = \{0, f(0)+2\}$. In one case, we have $f^2 (c) =b, f(c)=a\implies f(0)=f(0)+2$, contradiction, so therefore we must have the other case, meaning $f(c) = b, f^2(c) = f(b)=a$. Then $f^3(c) = f(c+1)+1 = f(b) + 1 = a+1=1$. But once again by injectivity, we have $\{ c,f(c), f^2(c), f^3 (c) \} = Z \backslash f^4 (Z)$, and from our previous expression, we have $f^4(n) = f(f(n) + 1) = n+f(f(0)+1)$, so $f^4(Z) = [f(f(0)+1), \infty)$. Since $\{ c,f(c), f^2(c), f^3(c) \} = \{c,f(c),0,1\}$, it follows that $\{c,f(c)\}=\{2,3\}$, so it's pretty clear from our expression for $f(Z)$ that $c=2, f(c)=3$.

Now we've established that $f(2)=3, f(3)=0, f(0)=1, f(f(n)+1) = n + f(f(0)+1) = n+3$. This last equality is all we really need to finish. We'll induct on $k$ to show that $f(4k)=4k+1, f(4k+2) = 4k+3, f(4k+3) = 4k, f(4k+1) = 4k+6$. For the base case, $k=0$, we've already shown the first three equalities. From $f(f(3)+1)=6$, we get $f(1)=6$, as desired.

For the inductive step, assume we've found the values of $f(0), f(1), \dots, f(4k-1)$. Then $f(f(4k-2) +1) = 4k+1 \implies f(4k)=4k+1$. Meanwhile, $f(f(4k) + 1) = 4k+3 \implies f(4k+2)=4k+3$, and $f(f(4k-3) +1) =4k$ yields $f(4k+3)=4k$. Finally, $f(f(4k+3)+1) = 4k+6\implies f(4k+1)=4k+6$, as claimed. Hence the solutions are $f(n)=n+1$ and $f(n)$ equalling $n+1$ for even $n$, $n-3$ for $n\equiv 3\pmod 4$, $n+5$ for $n\equiv 1\pmod 4$.
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
MathStudent2002
934 posts
#19 • 4 Y
Y by Muriatic, Aryan-23, Adventure10, Mango247
Very interesting graph theory problem.

Let $S = \operatorname{im} f$ and note that we must have $a\in S\implies a+1$ unless $a = f(0)$, so in particular $S$ is unbounded. Now, if $f(a) = f(b)$ for $a\neq b$ we get $f(a+1) = f(b+1)$, i.e. $f$ periodic, which is not allowed. Thus $f$ is injective, and $S$ is either of the form $\{\alpha, \alpha + 1,\ldots\}$ or $\{\alpha, \alpha+1,\ldots, \beta, \gamma+1, \gamma+2,\ldots\}$, where we let $\beta = f(0)$.

Now take the graph on $\mathbb Z_{\geq 0}$ where $a\to b$ if $f(a) = b$. Note that each element has indegree at most one and outdegree exactly one. We define the height of an element $k$ to be the largest $n$ such that there exists a path $a_n \to a_{n-1}\to a_{n-2}\to \cdots \to a_1 \to k$ (possibly infinity if $k$ is in a cycle). Note that $m = \alpha+(\gamma-\beta)$ elements have height $0$, and these each are the sources of chains which are subsets of $\mathbb Z_{\geq 0}$. Consider the $m$ elements with height $1$ or $2$, two from each chain. They are in $S$ but not in $f(f(S))$, so not in $f(\mathbb Z_{>0}+1)$, i.e. not in $\{\alpha+1, \ldots, \beta, \gamma+2,\ldots\}$. There at most $2$ possible such elements, so we conclude $2m \leq 2$ i.e. $m\leq 1$.

First we show $m\neq 0$. In that case, we have that $\mathbb Z _{\geq 0}$ is partitioned into a bunch of cycles. But then everything has infinite height, which is a contradiction since zero cannot have height $> 3$.

So, $m = 1$. Apply the extension of the $fff$ trick to get $f(f(n+1)+1) = f(f(f(f(n)))) = f(f(n)+1)+1$, i.e. $f(f(n)+1)$ is linear and equal to $n+c$ for some $c$. Then, $g(n) = f(f(f(f(n)))) = n+c$, which means that there can actually be no cycles in the graph since if $f^a(n) = n$. The exception to this is $c = 0$, which implies that $f(f(0)+1) = 0$, or $f(f(f(f(0)))) = 0$. But then $0$ is in a cycle again, which is not allowed.

So, there are no cycles, which in particular means we have a large chain. The two cases are $\beta = \gamma$, in which case $\alpha = 1$ and the thing looks like $0 \to \cdots$. Let $\beta = f(0)$, then since $\beta$ is not in $f(f(S))$ we see that $\beta$ is not in $f(\mathbb Z_{>0})$, i.e. $\beta-1\in \{0, \beta\}$, or $\beta = 1$. Now, similarly $f(f(0))-1 \in \{0,\beta\}$, so $f(1) = 2$. We claim that $f(n) = n+1$ by induction in this case. Indeed, we proceed by strong induction, with $n = 0,1 ,2$ clear. For the inductive step, take $n \geq 3$, and we invoke \[
n+1 = f(n-1)+1 = f(f(f(n-2)) = f(f(n-1)) = f(n)
\]and done.

The other case is $\gamma = \beta+1$, in which case $\alpha = 0$. So, our chain starts with $\beta+1$ and $S = \{0, 1, \ldots, \beta, \beta+2,\ldots\}$. Now, $f(f(S)) = f(\mathbb Z_{>0}) + 1 = \{1, 2, \ldots, \beta, \beta+3,\beta+4, \ldots\}$. So, $f(\beta+1)$ and $f(f(\beta+1))$ are $0, \beta+2$ in some order. Since $f(0) = \beta$, our chain must start with \[
\beta+1\to \beta+2\to 0 \to \beta 
\]Now $f(f(f(\beta+1))) = f(\beta+2) + 1$, so $\beta = 1$ and we get \[
2\to 3\to 0 \to 1\to\cdots.
\]Now we claim by induction that our solution is \[
A_0 \to A_1 \to \cdots,
\]where $A_i = (4i+2)\to (4i+3)\to (4i+0)\to(4i+1)$. In particular, we will show that $A_i$ forms the $i+1,\ldots,i+4$ elements of the chain, with $i = 0$ done. For the inductive step assume it is true for $i$, and we will show that \[
4i+2\to 4i+3\to 4i+0\to 4i+1\to 4i+6\to 4i+7\to 4i+4\to 4i+5.
\]Note that $f(f(f(4i+1))) = f(4i+2)+1 = 4i+4$ so this part is done. Let $f(4i+1) = k$. Then, $f(k) = f(f(f(4i+0))) = f(4i+1)+1 = k+1$. Then, we have \[
4i+2\to 4i+3\to 4i+0\to 4i+1\to k\to k+1\to 4i+4\to ?
\]\[
f(f(f(k))) = f(k+1)+1 = 4i+5.
\]Finally, $k = f(f(f(4i+3))) = f(4i+4)+1 = 4i+6$ and we are done. Our solutions are $f(n) = n+1$ and \[
2\to 3\to 0 \to 1 \to 6 \to 7 \to 4 \to 5 \to \cdots \to 4k+2\to 4k+3\to 4k\to 4k+1\to \cdots.
\]
This post has been edited 1 time. Last edited by MathStudent2002, Feb 2, 2019, 7:03 PM
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
v_Enhance
6862 posts
#20 • 7 Y
Y by enthusiast101, v4913, Kobayashi, gvole, crazyeyemoody907, Adventure10, Mango247
The answers are $f(n) = n+1$ and \[ f(n) = \begin{cases} 	n+1 & n \text{ even} \\ 	n+5 & n \equiv 1 \pmod 4 \\ 	n-3 & n \equiv 3 \pmod 4. \end{cases} \]One can check that both of these functions work. So we now have to prove they're the only ones.

Part I (involution tricks): We start with the usual involution trick: \[ f^4(n) = f(f(n+1)+1) = f(f(n)+1)+1. \]For $n \ge 1$ the last expression also equals \[ f^4(n) = f\left( f^3(n-1) \right)+1 = f^4(n-1)+1. \]So $f^4$ is linear with slope one, meaning
\[ f^4(n) = n+c \qquad (1) \]for some constant $c = f^4(0)$.

We have $c \neq 0$ since $c = f^4(0) = f(f(0)+1)+1 \ge 1$ according to the first line. (This is really the only time we use the far-right side of the first line until the end of the solution later.) In particular $f$ is injective and has no fixed points.

Next the old involution trick yet again (this time in degree $5$) gives
\[f(n+c) = f^5(n) = f(n)+c \qquad (2). \]
Because of (1) we can also view $f$ as function modulo $c > 0$, say $f \colon {\mathbb Z}/c \to {\mathbb Z}/c$. In fact:

Claim: The function $f$ is a bijection on ${\mathbb Z}/c$.

Proof. We have $f^4 \colon {\mathbb Z}/c \to {\mathbb Z}/c$ is the identity, so $f$ is a bijection (with inverse $f^3$). $\blacksquare$

Remark: Although we will not need it, one can show already that all cycles have length $4$. We claim that for each $n$ the elements \[ (n, f(n), f^2(n), f^3(n)) \]are distinct in ${\mathbb Z}/c$. Indeed, if $n$ and $f(n)$ differed by a multiple of $c$, say $f(n) = n+kc$, then (2) would apply in tandem with with (1) to get $f^4(n) = n+ 4kc \neq n+c$, contradiction.

Proving this now has the advantage of making Part III later easier.

Part II (the system): Now we do a global sum in order to to show $c = 4$. The basic idea is that because of (2), the quantity \[ S = \sum_{n=1}^c \left( f(x_n) - x_n \right) \]is constant for any complete residue system $(x_1, \dots, x_n) \pmod c$. So in particular \begin{align*} 	S &= \sum_{n=0}^{c-1} \left( f^1(n) - n \right) = A_1 - \frac{1}{2} c(c-1) \\ 	S &= \sum_{n=0}^{c-1} \left( f^2(n) - f^1(n) \right) = A_2 - A_1 \\ 	S &= \sum_{n=0}^{c-1} \left( f^3(n) - f^2(n) \right) = A_3 - A_2. \\ 	S &= \sum_{n=0}^{c-1} \left( f^4(n) - f^3(n) \right) = \frac{1}{2} c(c-1) + c^2  - A_3 \end{align*}where \[ A_k = \sum_{n=0}^{c-1} f^k(n) \qquad k = 1, 2, 3. \]But we have the additional relation \begin{align*} 	A_3 &= \sum_{n=0}^{c-1} f^3(n) = \sum_{n=0}^{c-1} \left( f(n+1)+1 \right) 	= A_1 + f(c) - f(0) + c = A_1 + 2c. \end{align*}Solving the system of equations gives $c=4$, $A_1 = 10$, $A_2 = 14$, $A_3 = 18$, $S = 4$.

Part III (the surprise): Hence, it remains to determine the values of $f$ on $\{0, 1, 2, 3\}$. This is a finite case check; one of many solutions is presented here. Of course $f(0)+f(1)+f(2)+f(3) = A_1 = 10$.

As $n+4=f^4(n)=f(f(n)+1)+1$, we have \[ f(f(n)+1)=  n+3. \]We call this property $P(n)$ and use it pin down the small values of $f$.

Claim: $f(0) = 1$ and $f(2) = 3$.

Proof. Note that $f(f(0)+1) = 3$ by $P(0)$.
  • $f(0) = 0$ fails by taking $n=0$ in the original.
  • $f(0) = 2$ implies $f(3) = 3$, which then gives $3 = f^3(3) = f(4)+1 \implies f(4)=2$ which is wrong.
  • If $f(0) \ge 3$ then $P(0)$ gives $f(f(0)-3) = f(f(0)+1)-4 = -1$, which is absurd.
So $f(0) = 1$; thus $f(2) = 3$. $\blacksquare$

We now have $f(1) + f(3) = 6$. We now consider cases on $f(1)$.
  • If $f(1) = 0$, then $P(1)$ gives $f(1) = 4$, wrong.
  • If $f(1) = 2$, we recover $f(n) \equiv n+1$.
  • If $f(1) = 4$, then $P(1)$ gives $f(5) = 4$, wrong since $f(5) = f(1)+4 = 8$.
  • If $f(1) = 6$, we recover the other solution described at the beginning of the proof.
This exhausts all cases, so the solutions we claimed are the only ones.
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
yayups
1614 posts
#21 • 3 Y
Y by L567, MatBoy-123, Adventure10
This is quite a long and robust problem. The solution comes in three parts, the first being standard FE tricks, the second being looking at the arrow decomposition, and the last part being a case bash.

We claim the solutions are $f(n)\equiv n+1$ and $f(n)\equiv\phi(n)$ where
\[\phi(n):=\begin{cases} 
      n+1 & n\equiv 0\pmod{4} \\
      n+5 & n\equiv 1\pmod{4} \\
      n+1 & n\equiv 2\pmod{4} \\
      n-3 & n\equiv 3\pmod{4} \\
   \end{cases},\]which we can check both work.


Note that the FE implies
\[f(f(n)+1)+1=f^3(f(n))=f(f^3(n))=f(f(n+1)+1),\]so
\[f^4(n)=f(f(n+1)+1)=f(f(n)+1)+1=f(f(n-1)+1)+2=\cdots=f(f(0)+1)+1+n.\]Let $d=f(f(0)+1)+1\ge 1$, so we have $f^4(n)=n+d$. This already implies that $f$ is injective and that the image of $f$ contains $\{d,d+1,\ldots\}$. Now, we simply note that
\[f(n+d)=f(f^4(n))=f^4(f(n))=f(n)+d.\]So we have the two equations $\boxed{f^4(n)=n+d}$ and $\boxed{f(n+d)=f(n)+d}$ for some fixed integer $d\ge 1$. This completes the standard FE tricks portion.

Let $G$ be the directed graph such that $a\mapsto b$ if and only if $f(a)=b$. If there was a cycle, say $f^m(x)=x$ for $m\ge 2$, then we would get
\[x=f^{4m}(x)=x+4d,\]which is a contradiction. Thus, there are no directed cycles. Furthermore, since $f$ is injective, each vertex has indegree and outdegree $1$. This implies that $G$ looks like a disjoint collection of chains of the form
\[x\mapsto f(x)\mapsto f^2(x)\mapsto\cdots.\]We see that the complement of the image of $f$ is finite, so the number of such chains is finite. Let $x_1,\ldots,x_m$ be the starting points of the $m$ chains. Given any $x\in\mathbb{Z}_{\ge 0}$, let $\delta(x)$ denote its distance to the starting point of the chain that it's in.

Note that if $f(x)\ge d$, then $f^4(x-d)=x$, so $\delta(x)\ge 4$. This implies that
\[x_i,f(x_i),f^2(x_i),f^3(x_i)<d\]and $f^r(x_i)\ge d$ for all $r\ge 4$. Since the complement of the image of $f$ is finite, we see that every residue class mod $d$ is hit, so in particular, $\{f(0),\ldots,f(d-1)\}$ contains all the residue classes. From the above, we see then that the sets
\[\{x_i,f(x_i),f^2(x_i),f^3(x_i)\}_{i=1}^m\]partition $\{0,\ldots,d-1\}$ exactly (this implies $d=4m$ in particular).

From this, we can see that there is a permutation $\sigma$ on $\{0,1\ldots,d-1\}$ such that
\[f(\sigma(i))=i+\epsilon_i d\]where exactly $m=d/4$ of the $\epsilon_i$s are equal to $1$ (these correspond to the $i\in[0,d-1]$ that come from $f^3(x_j)$) and the rest are $0$. We also see that
\[f^3(i)=f^{-1}(i+d)=\sigma(i)+(1-\epsilon_i)d\]since if $\epsilon_i=1$, then $f(\sigma(i))=i+d$ and if $\epsilon_i=0$, then $f(\sigma(i)+d)=i+d$.

Now, we have $f^3(i)=f(i+1)+1$ for all $i\in\{0,\ldots,d-1\}$, so summing, we see that
\[\sum_{i=0}^{d-1}f^3(i)=d+\sum_{i=1}^d f(i)=2d+\sum_{i=0}^{d-1}f(i).\]Thus,
\[(0+\cdots+(d-1))+d\left(d-\sum_{i=0}^{d-1} \epsilon_i\right)=2d+(0+\cdots+(d-1))+d\sum_{i=0}^{d-1}\epsilon_i,\]so
\[\sum_{i=0}^{d-1}\epsilon_i = \frac{d-2}{2}.\]However, we already know that exactly $d/4$ of the $\epsilon_i$ are $1$ and the rest are $0$, so
\[\frac{d}{4}=\frac{d-2}{2},\]or $\boxed{d=4}$. This completes the arrow decomposition portion.

We now know that fixing $(i,f(i),f^2(i),f^3(i))=(a,b,c,d)$ to be some permutation of $(0,1,2,3)$ uniquely determines the function, since its graph is just a chain starting from these $4$. This is a finite case check of size $4!=24$, but its actually not that bad if one is careful.

Suppose $a=0$. Then, the FE gives $f^3(0)=f(1)+1$, and we have $f(1)\ne 0,1$ (it can't be $0$ since $0$ starts the chain). Also, $f^3(0)\ne 0,1,2$ (since $f(1)\ne 0,1$), so $f^3(0)=3$. Thus, we must have $f(1)=2$, so $(a,b,c,d)=(0,1,2,3)$. This corresponds to the solution $f(n)=n+1$, which is one of the claimed solutions at the beginning.

Now, suppose $a=1$. Then, the FE gives $f^3(1)=f(2)+1$, and we have $f(2)\ne 1,2$ (it can't be $1$ since $1$ starts the chain). Also, $f^3(1)\ne 1,2,3$ (since $f(2)\ne 1,2$), so $f^3(1)=0$. This is a contradiction as $f^3(1)=f(2)+1\ge 1$, so there are no solutions in this case.

Now, suppose $a=2$. Then, the FE gives $f^3(2)=f(3)+1$, and we have $f(3)\ne 2,3$ (it can't be $2$ since $2$ starts the chain). Also, $f^3(2)\ne 2,3,4$, so $f^3(2)\in\{0,1\}$. However, $f^3(2)\ge 1$, so $f^3(2)=1$, $f(3)=0$, so $(a,b,c,d)=(2,3,0,1)$. This corresponds to the solution $f(n)=\phi(n)$, which is one of the claimed solution at the beginning.

Finally, suppose $a=3$. The FE then gives $f^3(3)=f(4)+1=f(0)+2$, and we have $f(0)\ne 0,3$. Thus, $f^3(3)\ne 3,2,5$, so $f^3(3)\le 1$. This is a contradiction since $f^3(3)=f(0)+2\ge 2$, so there are no solutions in this case.

This completes the case bash, and thus the solution.
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
IndoMathXdZ
691 posts
#22 • 3 Y
Y by GorgonMathDota, MatBoy-123, Adventure10
Let $P(n)$ denote the assertion of $n$ to the given functional equation
\[ P(n) : f(f(f(n))) = f(n + 1) + 1 \]
Denote $f^k(x)$ as the composition of $x$ by the function $f$ as many as $k$ times.
Claim 01. $f^4(n) = n + c$ for a constant $c$.
Proof. Notice that $P(f(n))$ ad $P(f(n - 1))$ gives us
\[ f^4(n) = f^3 ( f(n)) = f(f(n) + 1) + 1 = f( f^3 (n - 1)) + 1 =  f^4(n - 1) + 1 \]Therefore, we can have $f^4(n) = f^4(0) + n$.
Denote $f^4(0) = c$, then we have $f^4(n) = n + c$.
Claim 02. $f$ is injective.
Proof. If $f(a) = f(b)$, then we have
\[ a + c = f^4 (a) = f^4 (b) = b + c \]Therefore, we must have $a = b$, proving that $f$ must be injective.
Claim 03. $f(n + c) = f(n) + c$.
Proof. Notice that
\[ f(n + c) = f( f^4 (n) ) = f^5 (n) = f^4 (f(n)) = f(n) + c \]
Claim 04. $c$ is divisible by $4$.
Proof. Here's the graph theory portion. We claim that
\[ n, f(n), f(f(n)), f(f(f(n))) \]are distinct in $\mathbb{Z}_c$.
Suppose $f(n) \equiv n \ (\text{mod} \ c)$, take $f(n) = n + kc$. Therefore,
\[ f(f(f(f(n)))) = f(f(f(n + kc))) = f(f(f(n))) + kc = f(f(n)) + 2kc = f(n) + 3kc = n + 4kc \]This gives us $4k = 1$, a contradiction.
Suppose $f(f(n)) \equiv n \ (\text{mod} \ c)$, take $f(f(n)) = n + kc$. Therefore,
\[ f(f(f(f(n)))) = f(f(n + kc)) = n + 2kc \]This gives us $2k = 1$, a contradiction.
Suppose $f(f(f(n))) \equiv n \ (\text{mod} \ c)$, take $f(f(f(n))) = n + kc$. Therefore,
\[ f(f(f(f(n)))) = f(n + kc) = f(n) + kc \]This gives us $f(n) \equiv n \ (\text{mod} \ c)$, which has been done before.
By injectivity, we get that $\{ n, f(n), f(f(n)), f(f(f(n)))$ are distinct in $\mathbb{Z}_c$.

Consider the graph $G$ where every vertex denote a residue in $\mathbb{Z}_c$ and connect $a \to b$ when $f(a) = b$. We get that we can partition graph $G$ into distinct cycles of length $4$. (Notice that by injectivity, no two cycles will coincide.)
Therefore, $4 | c$.
We'll first consider the case where $c = 0$:
This is immediate as
\[ n = f^4(n) = f(f(n+1) + 1) = f(f(n) + 1) + 1 \]Plug $n = 0$ to the above equation, and we have $f(f(0) + 1) = -1$, a contradiction as $f : \mathbb{Z}_0 \to \mathbb{Z}_0$.
Claim 05. If $c \not= 0$, then $c$ must be $4$.
Proof. This is one of the best arguments I've seen in a while.
Notice that $\{ f(0), f(1), f(2), \dots, f(c - 1) \}$ and $\{ 0 , 1 , 2 , \dots, c - 1 \}$ are the same in $\mathbb{Z}_c$.
We'll try to double count the values of
\[ Q(k) : \sum_{i = 0}^{c - 1} f(i) - i \]which must be constant due to obvious reasons.
Denote $S_m = \sum_{i = 0}^{c - 1} f^m (i) $. By assertion $Q(S_m)$, we have
\[ S_{m + 1} - S_m \ \text{being constant} \]Now, notice that
\[ S_4 - S_3 = S_3 - S_2 = S_2 - S_1 = S_1 - S_0 \]Therefore, we have $S_4 = 4S_1 - 3S_0 \ $ by easy manipulation and
\[ S_4 = \sum_{i = 0}^{c - 1} f^4(i) = \sum_{i = 0}^{c - 1} ( i + c ) = S_0 + c^2 \]We then have $4 (S_1 - S_0) = c^2$.

Now, notice that $P(k)$ gives us
\[ \sum_{i = 0}^{c - 1} f(f(f(i))) = \sum_{i = 0}^{c - 1} ( f(i + 1) + 1 ) = c + \sum_{i = 1}^c f(i) = 2c + \sum_{i = 0}^{c - 1} f(i) \]by considering $f(c) = f(0) + c$.
This means that $S_3 - S_1 = 2c$.
But, we know that
\[ 2c = S_3 - S_1 = 2(S_1 - S_0) = \frac{1}{2} ( 4 (S_1 - S_0) ) = \frac{1}{2} c^2 \]Therefore, $c = 4$.
Now, it's time for construction - bash!
Since $f(n + c) = f(n) + c$, we just need to consider the graph of vertex $0,1, 2, 3$.
We'll consider all of the following operation in $\mathbb{Z}_c$:

If $0 \to 2 \to 1 \to 3 \to 0$, then $f(1) = f^3(0) = f(1) + 1$, a contradiction.
If $0 \to 2 \to 3 \to 1 \to 0$, then $f(2) = f^3(1) = f(2) + 1$, a contradiction.
If $0 \to 3 \to 1 \to 2 \to 0$, then $f(3) = f^3(2) = f(3) + 1 $, a contradiction.
If $0 \to 1 \to 3 \to 2 \to 0$, then $f(2) = f^3(1) = f(2) + 1$, a contradiction.

We are left the case where $0 \to 1 \to 2 \to 3 \to 0$ and $0 \to 3 \to 2 \to 1 \to 0$.
Case 01. $0 \to 3 \to 2 \to 1 \to 0$.
Proof. If $f(1) = 0$, then
\[ 0 = f(0 + 1) = f(f(1) + 1) = f(f(0) + 1) + 1 \]a contradiction.
Since $f$ is surjective for all values $\ge 4$, then we must have $f(1) = 4$.
$P(0)$ gives us
\[ f^3(0) = f(1) + 1 = 5\]If $f(0) = 7$, then we must have $f^2(7) = f^3(0) = 5$, then $8 = 4 + f(1)= f(5) = f^3(7) = f(8) + 1$. This gives us $f(8) = 7$, which gives us $f(0) = -1$, a contradiction.
Therefore, we must have $f(0) = 3$.

If $f(2) = 5$, then
\[ f(6) + 1 = f^3(5) = f^4(2) = 2 + 4 = 6 \]Hence, $f(6) = 5$, giving us $f(2) = 1$, a contradiction.
Therefore, we must have $f(2) = 1$.

Since
\[ f(f(3) + 1) = f(f(2) + 1) + 1 = 2 \]and $f(3)$ is the minimal value of $2$ mod $4$ in all values of $f(4a + 3)_{a \ge 0}$. Hence, we must have $f(3) = 2$.

But easy checking gives us
\[8 = f(0) + 5 = f(4) + 1 = f^3(3) = f^2(2) = f(1) = 4\]a contradiction.
Case 02. $0 \to 1 \to 2 \to 3 \to 0$.
Proof. We consider two cases: If $f(3) = 0$ or $f(3) = 4$.
If $f(3) = 0$, then we must have
\[ f(1) + 1 = f^3(0) = f^4(3) = 7 \]and hence $f(1) = 6$.
Notice that $f(f(1) + 1) = f(f(0) + 1) + 1$. This gives us $f(f(0) + 1) = 3$. Since $f(2) \equiv 3 \ (\text{mod}  \ 4)$ and is the minimum among all values of $f(4a + 2)_{a \ge 0}$. Hence, $f(2) = 3$. This gives us $f(f(0) + 1) = f(2)$, which by injectivity gives us $f(0) = 1$.

To your surprise! By the property $f(n + 4) = n + 4$, we have that
$$\boxed{f(n) =\begin{cases} n + 1 & \text{if} \ n \equiv ( 0\ \text{mod} \ 2) \\ n + 5 & \text{if} \ n \equiv (1 \ \text{mod} \ 4) \\  n - 3 & \text{if} \ n \equiv (3 \ \text{mod} \ 4)  \end{cases}}$$is a solution. (Just check if you don't believe it!)

Now, if $f(3) = 4$, we have that
\[ f(9) + 1 = f^3(8) = f^4(7) = 11 \]Hence, $f(9) = 10$. This gives us $f(1) = 2$. Hence,
\[ f(3) = f(f(1) + 1) = f(f(0) + 1) + 1 \]This gives us $f(f(0) + 1) = 3$. Since $f(2)$ is the minimal value of $f(4a + 2)_{a \ge 0}$ and has the value of 3 modulo 4, we have that $f(2) = 3$. By injectivity, we have $f(0) = 1$, and therefore by the property $f(n + 4) = f(n) + 4$, we have that
$$\boxed{f(n) = n + 1}$$is a solution.

Al Fine!
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
TheUltimate123
1739 posts
#23 • 1 Y
Y by signifance
Solved with eisirrational.

First note that
\begin{align*}
f^4(n)&=f\left(f^3(n)\right)=f(f(n+1)+1)\\ &=f^3(f(n+1))-1=f^4(n+1)-1.
\end{align*}Hence $f^4(n)=n+c$ for some $c$; as a corollary, $f$ is injective.

By the same trick, we have $f(n+c)=f^5(n)=f(n)+c$. In what follows, we draw an arrow from $a$ to $b$ whenever $f(a)=b$.


Claim: Each nonnegative integer is an element in some infinite chain of the form \[w\to x\to y\to z\to w+c\to x+c\to y+c\to z+c\to\cdots,\]where $w$, $x$, $y$, $z$ are distinct nonnegative integers less than $c$.

Proof. This follows from $f^4(n)=n+c$. All elements of the chain are distinct, since the chain grows arbitrarily large, and otherwise it would be periodic.


It remains to see that $w,x,y,z<c$. Assume, for example, that $z\ge c$; then $f(z-c)=w$ by injectivity, so we may instead start our chain at $z-c$. The same argument applies for $w$, $x$, $y$, so we may suitably choose $w$ so that $w,x,y,z<c$. $\blacksquare$

It follows that $4\mid c$, since we can partition the elements of $\{0,1,\ldots,c-1\}$ into subsets $\{w,x,y,z\}$ of size $4$ such that $w\to x\to y\to z$.


Claim: $c=4$.

Proof. By Claim 1, for $c/4$ of the nonnegative integers $n<c$ is $f(n)<c$; analogously for $3c/4$ of the nonnegative integers $n<c$ is $f^3(n)<c$. Summing over the given functional equation,
\begin{align*}
\frac{c(c-1)}2+\frac{3c^2}4&=\sum_{n=0}^{c-1}f^3(n)=c+\sum_{n=1}^cf(n)\\ &=2c+\sum_{n=0}^{c-1}f(n)=\frac{c(c-1)}2+\frac{c^2}4+2c.
\end{align*}This solves to $c=4$. $\blacksquare$


What remains is a finite case check: there is a single chain $w\to x\to y\to z\to\cdots$ (with $\{w,x,y,z\}=\{0,1,2,3\}$) that covers all nonnegative integers. We take cases:
  • If $w=0$, then $z=f(1)+1\ge3$, so $z=3$ and $f(1)=2$; the corresponding chain is $0\to1\to2\to3\to\cdots$.
  • If $w=1$, then $z=f(2)+1\ge1$. Clearly $z\ne1$; $z\ne2$ since $f(2)\ne1$; and $z\ne3$ since $f(2)\ne2$.
  • If $w=2$, then $z=f(3)+1\ge1$. Clearly $z\ne2$; $z\ne3$ since $z\ne f(3)+1$; and $z=1$ implies $f(3)=0$, and the corresponding chain is $2\to3\to0\to1\to\cdots$.
  • If $w=3$, then $z=f(4)+1\ge5$.
In summary, the only valid chains are $0\to1\to2\to3\to\cdots$ and $2\to3\to0\to1\to\cdots$, so the answer is \[     \boxed{f(n)=n+1}\quad\text{or}\quad\boxed{f(n)=         \begin{cases}             n+1&\text{if $n$ even}\\             n+5&\text{if $n\equiv1\pmod4$}\\             n-3&\text{if $n\equiv3\pmod4$}     \end{cases} }. \]Both work, so we are done.
This post has been edited 1 time. Last edited by TheUltimate123, Apr 17, 2020, 6:59 AM
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
508669
1040 posts
#24
Y by
lyukhson wrote:
Let $\mathbb{Z}_{\ge 0}$ be the set of all nonnegative integers. Find all the functions $f: \mathbb{Z}_{\ge 0} \rightarrow \mathbb{Z}_{\ge 0} $ satisfying the relation
\[ f(f(f(n))) = f(n+1 ) +1 \]for all $ n\in \mathbb{Z}_{\ge 0}$.

Let $P(x)$ denote the statement of the problem or the assertion of the problem.

$P(f(x)) \implies f(f(x+1)+1)=f(f(x)+1)+1$.
Consider a function $g$ such that $f(f(x)+1)+1=g(x)$.

We see that here, $g(n+1) = g(n)+1$ and since the domain consists of only integers, we're free to say that $g(x) = x + c$ for some integer constant $c$ or in other words, $f(f(x)+1)=x+c-1$. Now, using the lemma mentioned by tash :
tash wrote:
Here is a related lemma

Lemma:
Let $ f:\mathbb{Z}_{\ge 0}\rightarrow\mathbb{Z}_{\ge 0} $ is such that $f^{(k)}(n)=n+a$.
Prove that
    1.
$a$ divides $k$

2. The set $\{0,1,\ldots, a-1\}$ can be partitioned into tuples $(r_1, r_2,\ldots, r_k)$ such that
\[
f(r_1)=r_2, f(r_2)=r_3, \ldots, f(r_{k-1})=r_k, f(r_k)=r_1+a.
\]
3. $ f^{(i)}(0)+\ldots+ f^{(i)}(a-1)=1+2+\dots+(a-1)+\frac{a^2}{k}i$


One can note that the function in the problem satisfies $f^{(4)}(n)=n+a$ and also for $g(n)=f(n)+1, $ $g^{(2)}(n)=n+a.$ Using the lemma it is not hard to get $a=4$ and to find the only two solutions:
    1.
$f(n)=n+1$

2. $f(n)=\begin{cases}n+1,\ n=2k\\
n+5,\ n=4k+1\\
n-3,\ n=4k+3
\end{cases}$

We get that the solutions are : $f(x) = x + 1$ or $f(x) = x + 1$ if $x$ is even and $f(x) = x + 5$ and $f(x) = x-3$ if $x \equiv 1$ and $3$ $\pmod{4}$ respectively.
This post has been edited 2 times. Last edited by 508669, Aug 10, 2020, 9:08 AM
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
Idio-logy
206 posts
#25 • 1 Y
Y by Nathanisme
Solution
This post has been edited 2 times. Last edited by Idio-logy, Aug 28, 2020, 12:12 AM
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
jj_ca888
2726 posts
#26 • 2 Y
Y by Mango247, Mango247
First, note that\[f^4(n) = f^3(f(n)) = f(f(n) + 1) + 1 = f(f^3(n-1)) + 1 = f^4(n-1) + 1\]so it follows that the function $f^4(n)$ is linear; so we may write $f^4(n) = n + c$ for a constant $c = f^4(0)$. Here we note that $f$ is injective, since if $f(a) = f(b)$, then\[b + c = f^3(f(b)) = f^3(f(a)) = a + c \implies a = b.\]Furthermore, we may also obtain $f(n+c) = f(f^4(n)) = f^4(f(n)) = f(n) + c$.

Note that $f^4(0) = c = 0$ is impossible since that would mean $f^4(n) = n$ and thus $f$ would be a bijection. Hence, an inverse $f^{-1}$ would exist and be defined for all $n$ thus $f^{-1}(n) = f^3(n) = f(n+1) + 1$. Plugging in the value $n = f(0)$ would yield\[0 = f^{-1}(f(0)) = f(f(0) + 1) + 1 \geq 1\]which would indeed be a contradiction.

Otherwise, $c \neq 0$, and we claim that $\{n, f(n), f^2(n), f^3(n)\}$ are all different modulo $c$ for all $n$. If not:
  • If $f(k) \equiv k \pmod c$ for some $k$, then setting $f(k) = k + mc$ gives\[f^4(k) = f^3(k + mc) = f^2(f(k) + mc) = f(f^2(k) + mc) = f^3(k) + mc\]since $f(n+c) = f(n) + c$ for all $n$, through induction, gives\[f(n + mc) = f(n + (m-1)c) + c = \ldots = f(n) + mc\]for all $n, m$. An unwrap yields\[f^3(k) + mc = f^2(k + mc) + mc = f^2(k) + 2mc = f(k) + 3mc = k + 4mc = f^4(k) = k + c\]which implies $4m = 1$, impossible. $\square$
  • If $f^2(k) = k$ for some $k$, then setting $f^2(k) = k + mc$ gives\[k + c = f^4(k) = f^2(k + mc) = f(f(k) + mc) = f^2(k) + mc = k + 2mc\]hence $2m = 1$, impossible. $\square$
  • If $f^3(k) = k$ for some $k$, then setting $f^3(k) = k + mc$ gives\[k + c = f^4(k) = f(k + mc) = f(k) + mc\]so $m = 1$. Thus $k + c = f^3(k) = f^4(k)$ which has been covered in the first case. $\square$
Thus, the chain $n, f(n), f^2(n), \ldots$ for any fixed $n$ has period $4$ modulo $c$, since $f^4(n) = n + c$ in general. Clearly, no two chains can have overlapping residues due to injectivity, so $\{0, 1, \ldots , c-1\}$ can be partitioned into some collection of disjoint chains (each covering $4$ residues), and thus $4 \mid c$. \newpage We will go on further to prove that in fact, $c = 4$. Notice that,\[\sum_{i = 0}^{c-1} f^3(i) = \sum_{i = 1}^{c} (f(i) + 1) = 2c + \sum_{i = 0}^{c-1} f(i) \implies \sum_{i = 0}^{c-1} f^3(i) - \sum_{i=0}^{c-1} f(i) = 2c.\]Note that each of the elements of $\{0, 1, \ldots , c-1\}$ takes on the role of one of $\{f^0(\ell), f^1(\ell), f^2(\ell), f^3(\ell)\}$ for some chain defined by $\ell$. Since the chains are disjoint, exactly $\tfrac{c}{4}$ of them take on the role of each one. Denote set $S_0$ as the set of elements of $\{0, 1, \ldots , c-1\}$ that takes the role of some $f^0(\ell)$, and also similarly the sets $S_1, S_2, S_3$. Write\begin{align*}\sum_{i = 0}^{c-1} f^3(i) &= \sum_{i \in S_0} f^3(i) +\sum_{i \in S_1} f^3(i) +\sum_{i \in S_2} f^3(i) +\sum_{i \in S_3} f^3(i)\\
&= \sum_{i \in S_3} i + \sum_{i \in S_0} (i + c) + \sum_{i \in S_1} (i + c) + \sum_{i \in S_2} (i + c)\\&= (0 + 1 + \ldots + (c-1)) + \frac{3c^2}{4}\end{align*}\begin{align*}\sum_{i = 0}^{c-1} f(i) &= \sum_{i \in S_0} f(i) +\sum_{i \in S_1} f(i) +\sum_{i \in S_2} f(i) +\sum_{i \in S_3} f(i)\\
&= \sum_{i \in S_1} i + \sum_{i \in S_2} i + \sum_{i \in S_3} i + \sum_{i \in S_0} (i + c)\\&= (0 + 1 + \ldots + (c-1)) + \frac{c^2}{4}\end{align*}hence $\tfrac{3c^2}{4} - \tfrac{c^2}{4} = 2c$ and indeed, $c = 4$. Now, we finish the problem.

For any chain $f^0(\ell), f^1(\ell), \ldots$ it must be defined by $\{f^0(\ell), f^1(\ell), f^2(\ell), f^3(\ell)\} = \{0, 1, 2, 3\}$. The rest of the chain is automatically generated by $f^4(n) = n + c = n + 4$.
  • If $f^0(\ell) = \ell = 0$, then $f^3(0) = f(0 + 1) + 1 = f^1(1) + 1$. Clearly $1 = f^2(0)$ is implausible, and $1 = f^3(0)$ implies that $f^4(0) = 0$, which is false. Thus, $1 = f(0)$. Furthermore, we know $f^3(0) = f^2(0) + 1$ so $f^3(0)$ must be $3$, and $f^2(0)$ must be $2$. The chain must be $0, 1, 2, 3, \ldots$ and so on.
  • If $f^0(\ell) = \ell = 1$, then $f^3(1) = f(1 + 1) + 1 = f^1(2) + 1$. If $2 = f^1(1)$, then $f^3(1) - f^2(1) = 1$, which is not possible since $f^3(1), f^2(1) \in \{0, 3\}$. Clearly $2 = f^2(1)$ is implausible, and also, $2 = f^3(1)$ implies that $f^4(1) = 1$, which is false. This case is impossible.
  • If $f^0(\ell) = \ell = 2$, then $f^3(2) = f(2 + 1) + 1 = f^1(3) + 1$. Clearly $3 = f^2(2)$ is implausible, and $3 = f^3(2)$ implies that $f^4(2) = 2$, which is false. Thus, $3 = f(0)$. Furthermore, we know $f^3(0) = f^2(0) + 1$ so $f^3(0)$ must be $1$, and $f^2(0)$ must be $0$. The chain must be $2, 3, 0, 1, \ldots$ and so on.
  • If $f^0(\ell) = \ell = 3$, then $f^3(3) = f(3 + 1) + 1 = f(0) + 5$. Note that $f^3(3) - f(0)$ must always differ by at most $4$, so this is impossible.
Thus, the only two possible chains are\[0, f^1(0), f^2(0), \ldots = \{0, 1, 2, 3, 4 \ldots\} \text{ and } 2, f^1(2), f^2(2), \ldots = \{2, 3, 0, 1, 6 \ldots\}.\]We can extrapolate the answers from these two chains.

From the first chain, we get $f(0) = 1, f(1) = 2, f(2) = 3, f(3) = 4$. The rest of the function is automatically generated by $f^4(n) = n + 4$, so in this case, the solution of\[\boxed{f(n) = n + 1}\]is reached.

From the second chain, we get $f(2) = 3, f(3) = 0, f(0) = 1$, and $f(1) = 6$. Similarly, the rest of the function is automatically generated by $f^4(n) = n + 4$, so this case yields the solution of\[\boxed{f(n) =
\begin{cases}
 n+1 & \text{     if     }n \equiv 0 \pmod 4\\
 n+5 & \text{     if     }n \equiv 1 \pmod 4\\
 n+1 & \text{     if     }n \equiv 2 \pmod 4\\
 n-3 & \text{     if     }n \equiv 3 \pmod 4. 
\end{cases}}\]These two solutions both clearly work, so we are done. $\blacksquare$
brain orgasm
This post has been edited 6 times. Last edited by jj_ca888, Dec 28, 2020, 4:20 AM
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
DottedCaculator
7305 posts
#27 • 1 Y
Y by centslordm
Solution
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
ZETA_in_olympiad
2211 posts
#28 • 1 Y
Y by Mango247
Complete Solution
This post has been edited 4 times. Last edited by ZETA_in_olympiad, May 26, 2022, 10:58 AM
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
Inconsistent
1455 posts
#29
Y by
Notice $f(f(f(f(n)))) + 1 = f(f(n+1)+1)+1 = f(f(f(f(n+1))))$ so $f(f(f(f(n)))) = n+c$ for some constant $c \geq 0$.

Consider $c = 0$, then $f$ forms only $4$-cycles and $2$-cycles. Notice if $n$ is the local max of a cycle then so is $n + 1$, but not every number is a local max so contradiction.

Consider $c > 0$, then $c$ is injective whose chains only begin between $0$ and $c-1$ inclusive. Thus $f$ forms a draconic chain, a function dictated by a finite set of chains. A quasi-linear function. We know each chain takes four of the$c$ starting values. Anyways, simply sum the given over $n = 0$ to $n = c-1$ to get $\frac{1}{2}c^2 = 2c$ so $c = 4$.

Casework on the order of the first four elements of the chain gives two solutions:

$f(n) = n + 1$

and

$f(n) = \begin{cases}
n + 1 & 2 \mid n \\
n + 5 & 4 \mid n - 1 \\
n - 3 & 4 \mid n + 1 \\
\end{cases}$
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
awesomeming327.
1665 posts
#30
Y by
Let $P(n)$ be the assertion. Note that $f(P(n-1))+1$ gives $f(f(n)+1)+1=f^4(n-1)+1$. On the other hand, $P(f(n))$ gives $f^4(n)=f(f(n)+1)+1$ so \[f^4(n)=n+c\]where $c=f^4(0)$. Now, $f(n)+c=f^5(n)=f(n+c)$. If $f(a)\equiv f(b)\pmod c$ then $f^4(a)\equiv f^4(b)\pmod c$ so $a\equiv b\pmod c$. Thus, for any list $\{x_1,x_2,\dots, x_c\}$ that forms a complete residue system $\pmod c$ then $\{f(x_1),f(x_2),\dots, f(x_c)\}$ also does. Let $g(x)=f(x)-x$. Note that $g(n+c)=f(n+c)-(n+c)=f(n)-n=g(n)$. We have if $a\equiv b\pmod c$ then $g(a)=g(b)$.

If $\{x_1,x_2,\dots, x_c\}$ forms a complete residue system $\pmod c$ then there exists a permutation, $\{x_{\sigma_1},x_{\sigma_2},\dots, x_{\sigma_c}\}$ such that $f(x_{\sigma_1})\equiv x_1\pmod c$. Then, \begin{align*} g(x_1)+g(x_2)+\dots + g(x_c) &= g(f(x_{\sigma_1}))+g(f(x_{\sigma_2}))+\dots +g(f(x_{\sigma_c})) \\
&= g(f(x_1))+g(f(x_2))+\dots+g(f(x_c))\end{align*}In particular, using on $\{0,1,\dots, c-1\}$, we have
\[g(0)+g(1)+\dots + g(c-1)=g(f(0))+g(f(1))+\dots +g(f(c-1))=g(f^2(0))+g(f^2(1))+\dots +g(f^2(c-1))\]Let $S=f(0)+f(1)+\dots+ f(c-1)$ then \[f^3(0)+f^3(1)+\dots + f^3(c-1)=f(1)+1+f(2)+1+\dots + f(c)+1=c+S+f(c)-f(0)=S+2c\]and Thus, \[2c=g(f^2(0))+g(f(0))+\dots + g(f^2(c-1))+g(f(c-1))=2\left(S-\frac{c(c-1)}{2}\right)\]implying $2S=c(c+1)$.
On the other hand,
\[g(0)+g(1)+\dots + g(c-1)=g(f^3(0))+g(f^3(1))+\dots +g(f^3(c))\]Which gives \[S-\frac{c(c-1)}{2}=c^2+\frac{c(c+1)}{2}-S-2c\]so $2S=c(2c-3)$. Either $c=0$ or $c=4$. If $c=0$ then $f(0)=0$ so $P(0)$ gives $f(1)=-1$, absurd.

We know that $c=4$. It remains to determine $f(0),f(1),f(2),f(3)$. We have $S=f(0)+\dots + f(3)=10$. We have $f^4(0)=f(f(0)+1)+1$ so $f(f(0)+1)=3$. If $f(0)\ge 3$ then $f(f(0)-3)= -1$, absurd. If $f(0)=2$ then $f(3)=3$, so $f^3(3)=f(4)+1=3$, absurd. We already know $f(0)\neq 0$, so $f(0)=1$, implying $f(2)=3$. Thus, $f(n)=n+1$ for all even $n$.

We have $f(1)+f(3)=6$. Note that $f(1)$ and $f(3)$ are both even. If $f(1)=0$ then $5=f^4(1)=f(1)+1$, absurd. If $f(1)=4$ then $5=f(5)+1$ so $f(1)=0$, absurd. $f(1)=2$ and $f(1)=6$ both give valid solutions, which are
\[f(n)=n+1\]and
\[ f(n) = \begin{cases} n+1 & n \equiv 0\pmod 4 \\ n+5 & n \equiv 1 \pmod 4 \\ n+1 & n \equiv 2\pmod 4 \\ n-3 & n \equiv 3 \pmod 4. \end{cases} \]
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
YaoAOPS
1492 posts
#31
Y by
Claim: $f^4(x-1)+1 = f^4(x)$
Proof. Note that \[ f^4(x) = f^3(f(x)) = f(f(x) + 1) + 1 > 0 \]but also that \[ f^4(x) = f(f^3(x)) = f(f(x+1)+1) \]Thus, $f^4(x-1) = f(f(x)+1) = f^4(x) - 1$ $\blacksquare$
Inductively, this means that $f^4(x) = f^4(0) + x$ As such, $f$ is injective.
Let $c = f^4(0) > 0$.

Claim: $f(x + c) = f(x) + c$.
Proof. Consider $f^5(x)$ to get that \[ f^5(x) = f^4(f(x)) = f^4(0) + f(x) \]and that \[ f^5(x) = f(f^4(x)) = f(x + f^4(0)) \]Thus, if we let $c = f^4(0) > 0$ then $f(x + c) = f(x) + c$. $\blacksquare$
Since $f$ is injective, it follows that the residues $\pmod{c}$ form a bijection.
As such, it follows that $f(x) - x$ only depends on its residue.
Thus, \[ S = \sum_{i=0}^{c-1} (f(x_i) - x_i) \]is constant if $(x_0, x_1, \dots)$ is a complete residue system.

Claim: $c = 4$
Proof. It follows that \[ 4 \cdot S = \sum_{i=0}^{c-1} (f^4(i) - i) = c^2, \]meaning that $S = \frac{c^2}{4}$.
Then, since \[ c = \sum_{i=0}^{c-1} (f^3(n) - f(n + 1)) = \sum_{i=0}^{c-1} (f^3(n) - f(n)) - c = 2 \cdot S - c \]it follows that $S = c$.
Thus, $c = \frac{c^2}{4}$ and $c = 4$. $\blacksquare$
As such, $\{f(0), f(1), f(2), f(3)\}$ is the same as $\{0, 1, 2, 3\}$ with one of the elements having $4$ added to it.
Furthermore, since $f^4(x) = x + 4$, it follows that no residue maps to itself. Similarily $f$'s graph can not consist of two cycles, and can only be one $4$ element cycle.
Testing the $6$ cycles means that when considered as an element of $S_4$, $f$ is either $(0123)$ or $(3210)$.
Manually checking gives that for the first case, either $f(x) = x + 1$ or \[ f(x) = \begin{cases} x - 3 & x \equiv 3 \pmod{4} \\ x + 1 & x \ne 0, 2 \pmod{4} \\ x + 5 & x \equiv 1 \pmod{4} \end{cases}. \]
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
cj13609517288
1868 posts
#32
Y by
The answer is $\boxed{f(n)=n+1}$ and
\[\boxed{f(n)=\begin{cases}n+1&n\text{ is even}\\n-3&n\equiv 3\pmod 4\\n+5&n\equiv 1\pmod 4\end{cases}}.\]It is not hard to check that these work, so we will show that these are the only solutions.


Note that
\[f(f(f(f(n))))+1=f(f(n+1)+1)+1=f(f(f(f(n+1)))),\]so there exists some $c_0\in\mathbb{Z}_{\ge 0}$ such that $g:=f^4$ satisfies $g(n)=n+c_0$.

Claim. We have $c_0\in\{0,4\}$.
Proof. Assume that $c_0\ne 0$. Considering the arrows graph of $f$, we get that $4\mid c_0$, so let $c_0=4c$.Also by considering the arrows graph, we get that $f$ reaches all but exactly $c$ nonnegative integers.

Now let $h(n):=n+1$. Then we also have
\[f^4 = (f\circ h)^2.\]Therefore, $f\circ h$ reaches all but exactly $2c$ nonnegative integers, meaning that $f$ misses at least $2c-1$ nonnegative integers. Thus $c\ge 2c-1$, so $c\le 1$. $\blacksquare$

Case 1. $c_0=0$. Then $(f\circ h)^2 (n)=n$. We claim that this is not possible for $n=f(f(0)+1)$. In fact, since $f$ is a bijection(since $g$ is the identity), we would need to have
\[h(f(h(f(f(0)+1))))=f(0)+1\Longrightarrow h(f(f(0)+1))=0,\]absurd.
Case 2. $c_0=4$. Then $f$ cycles through all four residues mod $4$ then adds $4$ to the cycle, etc. Thus $f$ is injective. We have
\[f(h(f(h(3))))=f(h(f(4)))\in f(h(\{5,6,7,9,10,11\}))\in f(\{6,7,8,10,11,12\}),\]so
\[f(f^3(3))\in f(\{6,7,8,10,11,12\})\Longrightarrow f(f(f(3)))\in\{6,7,8,10,11,12\}.\]But $f(f(f(3)))<8$, and $f(f(f(3)))\ne 7$, so $f(f(f(3)))=6$, so $3+4=f(6)$, so $f(6)=7$, so $f(2)=3$.
This would also need $f(4)$ to be $5$, so $f(0)=1$. This indeed shows that the claimed solutions are the only ones, so we are done. $\blacksquare$
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
idkk
118 posts
#33
Y by
Outline of my proof:-

Prove that $f$ is injective.

Prove that if $m$ is the minimum value among $f(1),f(2),......$All values $\geq m$ are in range of $f$

Prove that there exist a positive integer $c$ such that $f^4(x)=x+c$ by abusing the involution trick

And then again abuse the involution trick to get $f(x+c)=f(x)+c$


So then $\{f(0),f(1),....,f(c-1)\}$ are distinct modulo $c$ and uniquely determine $f$


Observe the numbers $\{c,c+1,......\}$ are in the range of $f$

so each $f(i) \leq 2c-1$ where $i < c$
Prove there exist a non negative integer $b$ such that $f(x) \geq c \iff x \geq b$


Observe $f(f(f(x))) \leq c \iff f(x+1) \leq c-1 \iff x+1<b$
Observe $f(f(f(x))) \leq c-1 \iff f(f(x)) <b$ and keep in mind u have $f^3(x)=c$ as well thats at max one more solution
So let $A$ be the set of all solutions to the first ineuqliaty and $B$ for second then $A=B$
Prove that $f(x)<c$ must have atleast one solution

Use this to bound $c$ and finish the problem
This post has been edited 1 time. Last edited by idkk, May 13, 2024, 12:33 PM
Reason: ,
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
ihategeo_1969
162 posts
#34
Y by
Let $f^4(0)=c$ and we have \begin{align*} & f(f(n+1)+1)=f(f(n)+1)+1 \iff f^4(n)=f^4(n-1)+1 \text{ } \left(\spadesuit \right) 
\end{align*}Through induction we get that \[f^4(n)=n+c \implies f(n+c)=f(n)+c \text{ } \left(\clubsuit \right)\]Assume $c \leq 1$.

$\bullet$ If $c=0$, then $0=c=f(f(0)+1)+1$, which is a contradiction.
$\bullet$ If $c=1$, then $f(n+1)=f(n)+1$ will easily give us the only working function is $f(n)=n+1$.

Assume $c \geq 2$.

See that $f(n) \pmod c$ only depends on $n \pmod c$. Hence we get that \[\{f(0),f(1),\dots,f(c-1)\} \equiv \{0,1,\dots,c-1\} \pmod c\]Again see that $f(n)-n=f(n \pmod c)-n \pmod c$. And hence we get \[K=\sum_{i=0}^{c-1} f(i)-i=\sum_{i=1}^{c-1} f^2(i)-f(i)=\sum_{i=1}^{c-1} f^3(i)-f^2(i)=\sum_{i=1}^{c-1} f^4(i)-f^3(i)\]And so if we sum it up and use $\clubsuit$, we get that $K=\frac{c^2}4$. And see that again since we have \[f(f(n)+1)=n+c-1 \text{ and } \sum_{i=0}^{c-1} f(f(i)+1) \equiv \sum_{i=1}^{c-1} i \pmod c\]We get that \[(c-1)c=\sum_{i=1}^{c-1} f(f(i)+1)-i=K+\sum_{i=1}^{c-1} f(i)-i+1 = 2K+c = \frac{c^2}2+c \iff c=4\]Let $G_f$ be the digraph of $f$ on $\{0,1,2,3\}$ modulo $4$. That is $i \rightarrow j \iff f(i) \equiv j \pmod 4$.

One can do a big aah cash bash and see that the only digraph which satisfies $\spadesuit$ is $0 \rightarrow 1 \rightarrow 2 \rightarrow 3 \rightarrow 0$. Again recall that $f^4(0)=4$, check some values and see that the only two working functions are \[\boxed{f(n) \equiv n+1 \text{ } \forall \text{ } n \in \mathbb{Z}_{\geq 0}} \text{ AND  } \boxed{f(n)= \begin{cases} n+1 \text{ if } n \equiv 0 \pmod 2 \\ n+5 \text{ if } n \equiv 1 \pmod 4 \\ n-3 \text{ if } n \equiv 3 \pmod 4 \end{cases} \text{ } \forall \text{ } n \in \mathbb{Z}_{\geq 0}}\]
This post has been edited 2 times. Last edited by ihategeo_1969, Dec 10, 2024, 8:45 PM
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
Ilikeminecraft
300 posts
#35
Y by
buh

Take $f$ of both sides to get $f^4(n) = f(f( n + 1) + 1),$ subtract 1 and take $f$ 3 times to get $f^4(n + 1) = f^4(n) + 1$ or all nonnegative integers. Thus, if $f^4(0) = c > 0,$ then $f^4 \equiv n + c$. Take $f$ of both sides and we get $f(n + c) = f(n) + c.$

Assume $c > 1.$ If $c = 1,$ we get $f$ is linear, and thus, $f \equiv x + 1.$
\begin{claim}
$f$ is bijective over $\mathbb Z/c\mathbb Z.$
\end{claim}
\begin{proof}
Assume $f(a) = f(b).$ We get $f^3(a) = f(a + 1) + 1 = f(b + 1) + 1,$ so $f(a + 1) = f(b + 1).$ Thus, $f$ is identity over $\mathbb Z/c\mathbb Z.$ This is obviously impossible. Hence, $f$ is injective. Since the size of the sets are the same, $f$ is also bijective.
\end{proof}
Thus, we conclude $S = \sum_{n = 0}^{c - 1}f(n) - n$ is constant. Thus,
\begin{align*}
    S & = \sum_{n = 0}^{c - 1}f(n) - f^0(n) \\
    & = \sum_{n = 0}^{c - 1}f^2(n) - f^1(n) \\
    & = \sum_{n = 0}^{c - 1}f^3(n) - f^2(n) \\
    & = \sum_{n = 0}^{c - 1}f^4(n) - f^3(n) \\
\end{align*}However, also note that $\sum_{n = 0}^{c - 1}f^3(n) = \sum_{n = 0}^{c - 1}f(n + 1) + 1 = 2c + \sum_{n = 0}^{c - 1}f(n),$ so \[S = \sum_{n = 0}^{c - 1}f^3(n) - f^2(n) = \sum_{n = 0}^{c - 1} f^3(n) - f^2(n) = 2c + \sum_{n = 0}^{c - 1} f(n) - f^2(n) = 2c - S\]or $S = c.$ However, adding all the equations together, we get $4S = \sum_{n = 0}^{c - 1}f^4(n) - n = c^2.$ Hence, $c = 4.$

Recall that $f^4(n) = n + 4.$ Hence, $f(f(n) + 1) = n + 3.$ We plug values into this equation.
\begin{claim}
$f(0) = 1, f(2) = 3$
\end{claim}
\begin{proof}
We do casework on $f(0).$ Observe that $f(f(0) + 1) = 3.$
\begin{enumerate}
\item If $f(0) = 0,$ this is impossible
\item If $f(0) = 2,$ we must have $f(3) = 3.$ Impossible, as $3 = f^3(3) = f(4) + 1,$ so $f(4) = 2.$
\item If $f(0)\geq3,$ $f(f(0) - 3)=f(f(0) + 1) -4 = 3 - 4 = -1,$ contradicting the range
\end{enumerate}
\end{proof}
Recall that $\sum_{n = 0}^{3}f(n) - n = 4.$ Hence, $f(1) + f(3) = 6.$ We do casework on $f(1).$
\begin{enumerate}
\item If $f(1) = 0,$ taking $n = 1,$ we get $f(1) = 4,$ contradiction
\item If $f(1) = 2,$ we get $f\equiv n + 1,$ which works
\item If $f(1) = 4,$ taking $n = 1$ we get $f(5) = 4$
\item if $f(1) = 6,$ we get $f(3) = 0,$ which is valid.
\end{enumerate}
Thus, the solutions are $f\equiv x + 1, $ and
\[f\equiv\begin{cases}
    x + 1 & x \equiv 0 \pmod 2 \\
    x + 5 & x \equiv 1 \pmod 4 \\
    x - 3 & x \equiv 3 \pmod 4 \\
\end{cases}\]
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
Ilikeminecraft
300 posts
#36
Y by
Take $f$ of both sides to get $f^4(n) = f(f( n + 1) + 1),$ subtract 1 and take $f$ 3 times to get $f^4(n + 1) = f^4(n) + 1$ or all nonnegative integers. Thus, if $f^4(0) = c > 0,$ then $f^4 \equiv n + c$. Take $f$ of both sides and we get $f(n + c) = f(n) + c.$

Assume $c > 1.$ If $c = 1,$ we get $f$ is linear, and thus, $f \equiv x + 1.$
Claim: $f$ is bijective over $\mathbb Z/c\mathbb Z.$
Proof: Assume $f(a) = f(b).$ We get $f^3(a) = f(a + 1) + 1 = f(b + 1) + 1,$ so $f(a + 1) = f(b + 1).$ Thus, $f$ is identity over $\mathbb Z/c\mathbb Z.$ This is obviously impossible. Hence, $f$ is injective. Since the size of the sets are the same, $f$ is also bijective.

Thus, we conclude $S = \sum_{n = 0}^{c - 1}f(n) - n$ is constant. Thus,
\begin{align*}
    S & = \sum_{n = 0}^{c - 1}f(n) - f^0(n) \\
    & = \sum_{n = 0}^{c - 1}f^2(n) - f^1(n) \\
    & = \sum_{n = 0}^{c - 1}f^3(n) - f^2(n) \\
    & = \sum_{n = 0}^{c - 1}f^4(n) - f^3(n) \\
\end{align*}However, also note that $\sum_{n = 0}^{c - 1}f^3(n) = \sum_{n = 0}^{c - 1}f(n + 1) + 1 = 2c + \sum_{n = 0}^{c - 1}f(n),$ so \[S = \sum_{n = 0}^{c - 1}f^3(n) - f^2(n) = \sum_{n = 0}^{c - 1} f^3(n) - f^2(n) = 2c + \sum_{n = 0}^{c - 1} f(n) - f^2(n) = 2c - S\]or $S = c.$ However, adding all the equations together, we get $4S = \sum_{n = 0}^{c - 1}f^4(n) - n = c^2.$ Hence, $c = 4.$

Recall that $f^4(n) = n + 4.$ Hence, $f(f(n) + 1) = n + 3.$ We plug values into this equation.
Claim: $f(0) = 1, f(2) = 3$
Proof: We do casework on $f(0).$ Observe that $f(f(0) + 1) = 3.$
If $f(0) = 0,$ this is impossible
If $f(0) = 2,$ we must have $f(3) = 3.$ Impossible, as $3 = f^3(3) = f(4) + 1,$ so $f(4) = 2.$
If $f(0)\geq3,$ $f(f(0) - 3)=f(f(0) + 1) -4 = 3 - 4 = -1,$ contradicting the range

Recall that $\sum_{n = 0}^{3}f(n) - n = 4.$ Hence, $f(1) + f(3) = 6.$ We do casework on $f(1).$
If $f(1) = 0,$ taking $n = 1,$ we get $f(1) = 4,$ contradiction
If $f(1) = 2,$ we get $f\equiv n + 1,$ which works
If $f(1) = 4,$ taking $n = 1$ we get $f(5) = 4$
If $f(1) = 6,$ we get $f(3) = 0,$ which is valid.

Thus, the solutions are $f\equiv x + 1, $ and
\[f\equiv\begin{cases}
    x + 1 & x \equiv 0 \pmod 2 \\
    x + 5 & x \equiv 1 \pmod 4 \\
    x - 3 & x \equiv 3 \pmod 4 \\
\end{cases}\]
Z K Y
The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
HamstPan38825
8855 posts
#37
Y by
This is one of the best problems of all time. The answers are $f \equiv n + 1$ and
\[f(n) = \begin{cases} n+1 & n \equiv 0, 2 \pmod 4 \\ n+5 & n \equiv 1 \pmod 4 \\ n - 3& n \equiv 3 \pmod 4. \end{cases}\]Verifying these solutions work is not difficult. Now, first for the easy part.

Claim: Let $c = f^4(0)$. Then, for all positive integers $n$, $f^4(n) = n+c$ and $f(n+c) = f(n) + c$.

Proof: Writing $f^4(n)$ in two ways using the given yields \[f^4(n+1) = f(f(n+1) + 1) = f(f(n) + 1) + 1 = f^4(n) + 1\]which implies that $f^4(n) = f^4(0) + n$, as needed. The second assertion comes from writing $f^5(n)$ in two ways using $f^4(n) = n+c$. $\blacksquare$

So $f$ is periodic modulo $c$. Next for the black magic part.

Claim: $c=4$.

Proof: Let $S$ be a complete residue system of integers modulo $c$. Notice that the sum \[A_S = \sum_{i \in S} \left(f(i) - i \right) = \sum_{i=0}^{c-1} \left(f(i) - i\right)\]is a constant $A$ for all choices of $S$. In particular, let $S_i = \{f^i(0), \dots, f^i(c-1)\}$ for $0 \leq i \leq 3$. Then \[2A = A_{S_1} + A_{S_2} = \sum_{i=0}^{c-1} \left(f^3(i) - f(i)\right) = c+f(c+1)-f(1) = 2c\]thus we get $A = c$. On the other hand, \[4A = A_{S_0} + A_{S_1} + A_{S_2}+A_{S_3}= \sum_{i=0}^{c-1} \left(f^4(i) - f(i)\right) = c^2\]implying $c = 4$. Wow. $\blacksquare$

In particular, since $f$ is injective, it follows that $f(0), f^2(0)$, and $f^3(0)$ are distinct residues modulo $4$. (Otherwise, we may scale up and down by $4$'s to find $f(a) = f(b)$.) On the other hand, since every sufficiently large integer congruent to $f^i(0)$ mod $4$ appears in the set $\{f^i(0), f^{i+4}(0), \dots\}$ for each $i$, it follows that for every positive integer $n$, there exists a (possibly negative) $k$ such that $f^k(0) = n$.

On the other hand, suppose that $a = f^{-3}(0)$ were defined. Then $0 = f^3(a) = f(a+1) + 1$, which is a contradiction; hence one of the three sets $\{f^{-2+i}(0), f^{-1+i}(0), f^i(0), f^{1+i}(0)\}$ for $0 \leq i \leq 2$ is congruent to the set $\{0, 1, 2, 3\}$. A quick case check yields the above solutions.

Remark: I am still in awe that the proof of the second claim just *works*. Indeed, I don't understand why considering the sum without looking at modulo $c$ would be motivated at all.
This post has been edited 1 time. Last edited by HamstPan38825, Mar 17, 2025, 11:06 PM
Z K Y
N Quick Reply
G
H
=
a