# Find all positive integers n such that $n + 3$ divides $n^2 + 27$ [duplicate]

Find all positive integers n such that $n + 3$ divides $n^2 + 27$.

I am quite stuck on how to conclusively show all of the solutions. I tried look at the intersections of $y = n^2 + 27$ and $f = x(n + 3)$ where is $x$ is some number. But it still involves setting $x$ values. Any help would be much appreciated.

## marked as duplicate by lab bhattacharjee elementary-number-theory StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Nov 18 '17 at 14:15

• Hint: $x^2+27=(x-3)(x+3)+36$. – lulu Nov 18 '17 at 14:13
Hint. Note that $$\frac{n^2+27}{n+3}=n-3+\frac{36}{n+3}$$ hence $n+3$ divides $n^2+27$, iff $n+3$ divides $36$, that is $$n+3\in\{1, 2, 3, 4, 6, 9, 12, 18, 36\}.$$