Like most Persian mathematicians of the period, Khayyám was also an astronomer and achieved fame in that role. In 1073, the Seljuq Sultan Jalal al-Din Malik-Shah Saljuqi (Malik-Shah I, 1072–92), invited Khayyám to build an observatory, along with various other distinguished scientists. According to some accounts, the version of the medieval Iranian calendar in which 2,820 solar years together contain 1,029,983 days (or 683 leap years, for an average year length of 365.24219858156 days) was based on the measurements of Khayyám and his colleagues. Another proposal is that Khayyám's calendar simply contained eight leap days every thirty-three years (for a year length of 365.2424 days). In either case, his calendar was more accurate to the mean tropical year than the Gregorian calendar of 500 years later. The modern Iranian calendar is based on his calculations.