Update similar caculate algorithm