Abstract:
Let $R$ be a ring with center $Z(R)$, let $n$ be a fixed positive integer, and let $I$ be a nonzero ideal of $R$. A mapping $h\colon R\to R$ is called $n$-centralizing ($n$-commuting) on a subset $S$ of $R$ if $[h(x),x^n]\in Z(R)$ ($[h(x),x^n]=0$ respectively) for all $x\in S$. The following are proved:
(1) if there exist generalized derivations $F$ and $G$ on an $n!$-torsion free semiprime ring $R$ such that $F^2+G$ is $n$-commuting on $R$, then $R$ contains a nonzero central ideal;
(2) if there exist generalized derivations $F$ and $G$ on an $n!$-torsion free prime ring $R$ such that $F^2+G$ is $n$-skew-commuting on $I$, then $R$ is commutative.