The number 40517 (forty thousand five hundred seventeen) is written in Roman numerals as follows: XLDXVII