A formula for the convergents of a continued fraction of Ramanujan