For positive
x,y with
xy<1, the tangent addition formula gives
arctanx+arctany =arctan1−xyx+y. Applying it twice:
arctan31+arctan41=arctan1−12131+41=arctan117,arctan117+arctan51=arctan1−557117+51=arctan2423.
The equation becomes
arctan2423 +arctann1=arctan1, so
1−24n232423+n1=1. Clearing denominators,
23n+24=24n−23, giving
n=47.