$ \def \divides {\mathrel {\big|}} $
Given an integer $ k $, find all the functions $ f : \mathbb N \to \mathbb N $ that satisfy $$ f ( n ) + f ( m ) \divides n ^ 2 + k f ( n ) m + f ( m ) ^ 2 $$ for all $ m , n \in \mathbb N $.
My Progress:
Substitute $ m = n \implies 2 f ( n ) \divides n ^ 2 + k n f ( n ) + f ( n ) ^ 2 \implies 2 f ( n ) \divides 2 n ^ 2 $.
We get $ f ( n ) = 1 $, $ f ( n ) = n $, $ f ( n ) = n ^ 2 $.
After that I don't know what I should do.
$ \def \Zp {\mathbb Z _ +} \newcommand \dv [2] {\left. #1 \ \middle\vert \ #2 \right.} $ You can show that the only $ f : \Zp \to \Zp $ satisfying $$ \dv { f ( n ) + f ( m ) } { n ^ 2 + k m f ( n ) + f ( m ) ^ 2 } \tag 0 \label 0 $$ for some constant $ k \in \mathbb Z $ and all $ n , m \in \Zp $ is the identity function, which only works when $ k = 2 $. It's straightforward to verify that this indeed gives a solution. To prove the converse, let's start with repeating what you've already done, for the sake of completeness. Setting $ m = n $ in \eqref{0} we get $$ \dv { 2 f ( n ) } { n ^ 2 + k n f ( n ) + f ( n ) ^ 2 } \tag 1 \label 1 \text , $$ and thus $$ \dv { 2 f ( n ) } { 2 n ^ 2 + 2 k n f ( n ) + 2 f ( n ) ^ 2 } \text . $$ As $ \dv { 2 f ( n ) } { 2 k n f ( n ) + 2 f ( n ) ^ 2 } $, that implies $ \dv { 2 f ( n ) } { 2 n ^ 2 } $, and therefore $$ \dv { f ( n ) } { n ^ 2 } \tag 2 \label 2 $$ for all $ n \in \Zp $. In particular, \eqref{2} implies $ f ( 1 ) = 1 $. Also, note that \eqref{1} proves evenness of $ f ( n ) $ for any even $ n \in \Zp $. Substituting $ n $ for $ m $ and $ 1 $ for $ n $ in \eqref{0} we get $$ \dv { f ( n ) + 1 } { f ( n ) ^ 2 + k n + 1 } \text , $$ and since $ \dv { f ( n ) + 1 } { f ( n ) ^ 2 - 1 } $, hence $$ \dv { f ( n ) + 1 } { k n + 2 } \text . \tag 3 \label 3 $$ Setting $ m = 1 $ in \eqref{0} we have $$ \dv { f ( n ) + 1 } { k f ( n ) + n ^ 2 + 1 } \text , $$ which together with $ \dv { f ( n ) + 1 } { k f ( n ) + k } $ gives $$ \dv { f ( n ) + 1 } { n ^ 2 - k + 1 } \text . \tag 4 \label 4 $$ Let $ l = ( k - 2 ) \left( k ^ 2 + k + 2 \right) $. Since $ l = ( k n - 2 ) ( k n + 2 ) - k ^ 2 \left( n ^ 2 - k + 1 \right) $, by \eqref{3} and \eqref{4} we get $$ \dv { f ( n ) + 1 } l \tag 5 \label 5 $$ for all $ n \in \Zp $.
If $ k \ne 2 $ then $ l $ has finitely many divisors, and we can find a prime number $ p $ greater than all of them, such that $ p \equiv 11 \pmod { 15 } $ (by Dirichlet's theorem). By evenness of $ f ( 2 p ) $, \eqref{2} and \eqref{5}, we have $ f ( 2 p ) \in \{ 2 , 4 \} $, as all the divisors of $ 4 p ^ 2 $ other than $ 2 $ and $ 4 $ are either odd or too large. Then, we have $ \dv { f ( 2 p ) + 1 } { k p + 1 } $, by \eqref{3} and the fact that $ f ( 2 p ) + 1 $ is odd. In case $ f ( 2 p ) = 2 $, we get $ \dv 3 { k p + 1 } $, which shows that $ k \not \equiv 0 \pmod 3 $. Hence $ k ^ 2 \equiv 1 \pmod 3 $, which gives $ k ( k p + 1 ) \equiv p + k \pmod 3 $, and thus $ \dv 3 { p + k } $. Also, from \eqref{4} we have $ \dv 3 { 4 p ^ 2 - k + 1 } $, and therefore $ \dv 3 { 4 p ^ 2 + p + 1 } $, which contradicts $ p \equiv - 1 \pmod 3 $. In case $ f ( 2 p ) = 4 $, we have $ \dv 5 { k p + 1 } $. We also have $ \dv 5 { 4 p ^ 2 - k + 1 } $ from \eqref{4}, and therefore $ \dv 5 { 4 p ^ 2 + k ( p - 1 ) + 2 } $, which contradicts $ p \equiv 1 \pmod 5 $. We arrived at a contradiction in every case, and therefore $ l $ can't be nonzero, and we must have $ k = 2 $.
It's now sufficient to prove that for any $ m \in \Zp $, $ f ( m ) = m $ implies $ f ( m + 1 ) = m + 1 $; because then the result follows by $ f ( 1 ) = 1 $ and mathematical induction. Assume $ f ( m ) = m $ for some $ m \in \Zp $. Letting $ n = m + 1 $ in \eqref{0} we get $$ \dv { f ( m + 1 ) + m } { ( m + 1 ) ^ 2 + m ^ 2 + 2 m f ( m + 1 ) } \text . $$ As $ \dv { f ( m + 1 ) + m } { 2 m f ( m + 1 ) + 2 m ^ 2 } $, we have $$ \dv { f ( m + 1 ) + m } { ( m + 1 ) ^ 2 + m ^ 2 - 2 m ^ 2 } = 2 m + 1 \text , $$ and therefore $$ a \big( f ( m + 1 ) + m \big) = 2 m + 1 $$ for some $ a \in \Zp $. If $ a \ge 2 $, then $$ 2 m + 1 = a \big( f ( m + 1 ) + m \big) \ge a ( 1 + m ) \ge 2 m + 2 \text , $$ which is impossible. Therefore we must have $ a = 1 $, which means $ f ( m + 1 ) = m + 1 $.