The number 40165 (forty thousand one hundred sixty-five) is written in Roman numerals as follows: XLCLXV