The number 21871 (twenty-one thousand eight hundred seventy-one) is written in Roman numerals as follows: XXIDCCCLXXI