Numerical and analytical study of evolution of indirect reciprocity