hey dude it is easy
39+312+315+3n=a3 where a

taking log both sides
9log3+12log3+15log3+nlog3=3loga
3log3+4log3+5log3+n/3log3=loga
log(33 x 34 x 35 x 3n/3)=loga
taking antilog
312+n/3=a
therefore for a to be a perfect cube n should be a multiple of 9.
smallest n=9.
hope u got it.........