Let q1 be quotient of first division and q2 be the quotient of second division, d be the divisor and let original number be num.
The 2 equations formed are:
1) num=d*q1+27

Multiplying equation-1 by 2 and equating the equations gives us

Shifting the d term on one side and numbers on the other 

Taking d common from the left side


So d can either be 51 or one of its factor(17 or 3)
Actually it is 51 because the dividend is always greater than the remainder. Thanks