The number 997871 (nine hundred ninety-seven thousand eight hundred seventy-one) is written in Roman numerals as follows: CMXCVIIDCCCLXXI