### Origin and Mathematics of the 30-Year Cycle

Early Islamic astronomy was largely based on that of the Hellenistic astronomer Claudius Ptolemy of Alexandria (fl. 150 CE) and the astronomical tables in his Almagest served as the foundation of many similar Islamic astronomical tables.

For the length of a lunation – the average interval from new moon to new moon – Ptolemy adopted the value of 29;31,50,8,20 days (expressed in sexagesimal notation) which had also been used during the last few centuries before the Common Era by Babylonian priest-astronomers. The same value, equivalent with 29d 12h 44m 3⅓s in modern time units, is still used in the present-day Hebrew calendar (where it is expressed as 29d 12h 793p).

From this value, the length of a lunar year with 12 lunations computes to 354;22,1,40 days, which can be approximated without great loss of accuracy to 354;22 days. Thus, by adding 22 intercalary days in every 60 lunar years – or equivalently, 11 intercalary days in every 30 lunar years – a tabular lunar calendar can be constructed which on average will closely follow the visible phases of the moon.

Calendrical tables based on this principle are thus based on a mean lunation of 10 631/360 = 29.530555... days, or 29d 12h 44m, which differs less than 3s from the true value (29d 12h 44m 2.80s). The error is so small that it will take several millennia before the accumulated error exceeds one day.

A complete 30-year cycle contains (19 × 354) + (11 × 355) = (30 × 354) + 11 = 10 631 days or 1 518 weeks and five days. Thus after seven 30-year cycles (or 210 years) the weekdays will repeat exactly again on the same days in the tabular lunar calendar. For this reason medieval Islamic calendrical tables were often given for a period of 210 years.

In the 8-year cycle, used in the past in the Ottoman Empire and in South-East Asia, the mean lunation length is 2 835/96 = 29.53125 days (29;31,52,30 days in sexagesimal notation), or 29d 12h 45m.

#### Distributing the Intercalary Years in the 30-Year Cycle

The attested intercalary schemes I to IV can be obtained by analysing the sequence S(n) = (11/30) × n, with n denoting the year in a 30-year cycle.

Inserting an intercalary day at the end of a year when the fractional part of S(n) first equals or exceeds a half day results in intercalation scheme I. Similarly, intercalation schemes II, III and IV result when the fractional part first exceeds 1/2, 3/5 or 2/3 day.

 n S(n) I II III IV n S(n) I II III IV n S(n) I II III IV ≥ 1/2 > 1/2 > 3/5 > 2/3 ≥ 1/2 > 1/2 > 3/5 > 2/3 ≥ 1/2 > 1/2 > 3/5 > 2/3 1 11/30 11 4   1/30 11 21 7 21/30 21 21 21 21 2 22/30 2 2 2 2 12 4 12/30 22 8   2/30 3 1   3/30 13 4 23/30 13 13 13 13 23 8 13/30 4 1 14/30 14 5   4/30 24 8 24/30 24 24 24 24 5 1 25/30 5 5 5 5 15 5 15/30 15 25 9   5/30 6 2   6/30 16 5 26/30 16 16 16 26 9 16/30 26 26 7 2 17/30 7 7 17 6   7/30 27 9 27/30 27 27 8 2 28/30 8 8 18 6 18/30 18 18 28 10   8/30 9 3   9/30 19 6 29/30 19 19 29 10 19/30 29 29 29 10 3 20/30 10 10 10 20 7 10/30 30 11 30

An arbitrary year y in the tabular Islamic calendar is an intercalary year when one of the following equalities is satisfied:

 Intercalationscheme Tabular Islamic year y is intercalary when I Mod[11 y + 15, 30] < 11 or Mod[19 y + 14, 30] > 18 II Mod[11 y + 14, 30] < 11 Mod[19 y + 15, 30] > 18 III Mod[11 y + 11, 30] < 11 Mod[19 y + 18, 30] > 18 IV Mod[11 y +   9, 30] < 11 Mod[19 y + 20, 30] > 18