Solution for arithGeo problem