Given: a6=2. Also, a1a4a5 is greatest.
⇒a+5d=2...(i)
Let, y=a1a4a5
⇒y=a(a+3d)(a+4d)
⇒y=(2−5d)(2−2d)(2−d)
⇒y=(4−4d−10d+10d2)(2−d)
⇒y=(4−14d+10d2)(2−d)
⇒y=8−4d−28d+14d2+20d2−10d3
⇒y=8−32d+34d2−10d3
⇒y′=−32+68d−30d2
⇒y′=−2(15d2−34d+16)
⇒y′=−2(5d−8)(3d−2)

So, the function attains maxima at d=58