2.
\(\frac{3n+9}{n-4}\in Z\)
\(\Rightarrow3n+9⋮n-4\)
\(\Rightarrow3n-12+21⋮n-4\)
\(\Rightarrow3\times\left(n-4\right)+21⋮n-4\)
\(\Rightarrow21⋮n-4\)
\(\Rightarrow n-4\inƯ\left(21\right)\)
\(\Rightarrow n-4\in\left\{-7;-3;-1;1;3;7\right\}\)
\(\Rightarrow n\in\left\{-3;1;3;5;7;11\right\}\)
\(B=\frac{6n+5}{2n-1}\in Z\)
\(\Rightarrow6n+5⋮2n-1\)
\(\Rightarrow6n-3+8⋮2n-1\)
\(\Rightarrow3\left(2n-1\right)+8⋮2n-1\)
\(\Rightarrow8⋮2n-1\)
\(\Rightarrow2n-1\inƯ\left(8\right)\)
\(\Rightarrow2n-1\in\left\{-8;-4;-2;-1;1;2;4;8\right\}\)
\(\Rightarrow2n\in\left\{-7;-3;-1;0;2;3;5;9\right\}\)
\(n\in Z\)
\(\Rightarrow n\in\left\{0;1\right\}\)