For a formula that returns all results {3;4;6;8;12;16;24;48} you can try:
=MODE.MULT(IF(MOD(50,ROW(2:50))=2,ROW(2:50),{"",""}))
If A1=50 and A2=2 you can change the 2:50 to INDEX(A:A,2):INDEX(A:A,A1) and the 2 to A2 as in John Jairo V's link. With this replacement the formula will recalculate at start up or whenever a value in column A changes.
More of theoretical interest, but for a truly non-volatile solution maybe try (versions 2013/16):
=MODE.MULT(IF(MOD(A1,INT(TREND(2*INT((2*A1)^0.5+1)^2+1^MUNIT((2*A1)^0.5+1),,,0)/6)+1)=A2,INT(TREND(2*INT((2*A1)^0.5+1)^2+1^MUNIT((2*A1)^0.5+1),,,0)/6)+1,""))