def EasterDate(year):
    """EASTER DATE CALCULATION FOR YEARS 1583 TO 4099
       This algorithm is an arithmetic interpretation of the 3 step
       Easter Dating Method developed by Ron Mallen 1985, as a vast
       improvement on the method described in the Common Prayer Book
       from: https://www.assa.org.au/edm

       param year
       returns date tuple (day, month, year)
    """
    FirstDig = year // 100
    Remain19 = year % 19

    # calculate PFM date
    temp = (FirstDig - 15) // 2 + 202 - 11 * Remain19

    def f(x):
        return {
                21: temp - 1,
                24: temp - 1,
                25: temp - 1,
                27: temp - 1,
                28: temp - 1,
                29: temp - 1,
                30: temp - 1,
                31: temp - 1,
                32: temp - 1,
                34: temp - 1,
                35: temp - 1,
                38: temp - 1,
                33: temp - 2,
                36: temp - 2,
                37: temp - 2,
                39: temp - 2,
                40: temp - 2,
            }.get(x, temp)
    temp = f(FirstDig)
    temp = temp % 30

    tA = temp + 21
    if temp == 29:
        tA = tA - 1
    if (temp == 28) and (Remain19 > 10):
        tA = tA - 1

    # find the next Sunday
    tB = (tA - 19) % 7

    tC = (40 - FirstDig) % 4
    if tC == 3:
        tC = tC + 1
    if tC > 1:
        tC = tC + 1

    temp = year % 100
    tD = (temp + temp // 4) % 7

    tE = ((20 - tB - tC - tD) % 7) + 1
    d = tA + tE

    if d > 31:
        return (d-31, 4, year)
    else:
        return (d, 3, year)