# original copy at http://www.w3.org/2000/10/swap/test/easter/easter.n3

PREFIX math: <http://www.w3.org/2000/10/swap/math#>
PREFIX log: <http://www.w3.org/2000/10/swap/log#>
PREFIX string: <http://www.w3.org/2000/10/swap/string#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX prolog: <http://eulersharp.sourceforge.net/2003/03swap/prolog#>
PREFIX : <http://www.agfa.com/w3c/euler/easterP#>

<> rdfs:comment """
              Divide            by      Quotient  Remainder
        ---------------------------------------------------
                 y               19                   j
                 y              100        k          h
                 k                4        m          n
               k + 8             25        p
             k - p + 1            3        q
        19j + k - m - q + 15     30                   r
                 h                4        s          u
        32 + 2n + 2s - r - u      7                   v
           j + 11r + 22v        451        w
         r + v - 7w + 114        31        x          z

Here x is the number of the month ond 1 + z is the day of that
month upon which Easter Sunday falls in the year y.
""".

2021 a :Year.
2022 a :Year.
2023 a :Year.
2024 a :Year.
2025 a :Year.
2026 a :Year.
2027 a :Year.
2028 a :Year.
2029 a :Year.
2030 a :Year.
2031 a :Year.
2032 a :Year.
2033 a :Year.
2034 a :Year.
2035 a :Year.
2036 a :Year.
2037 a :Year.
2038 a :Year.
2039 a :Year.
2040 a :Year.
2041 a :Year.
2042 a :Year.
2043 a :Year.
2044 a :Year.
2045 a :Year.
2046 a :Year.
2047 a :Year.
2048 a :Year.
2049 a :Year.
2050 a :Year.

{   ?Y a :Year.
    (?Y 19) math:remainder ?J.
    (?Y 100) math:integerQuotient ?K; math:remainder ?H.
    (?K 4) math:integerQuotient ?M; math:remainder ?N.
    ((?K 8)!math:sum 25) math:integerQuotient ?P.
    (((?K ?P)!math:difference 1)!math:sum 3) math:integerQuotient ?Q.
    ((((((19 ?J)!math:product ?K)!math:sum ?M)!math:difference ?Q)!math:difference 15)!math:sum 30) math:remainder ?R.
    (?H 4) math:integerQuotient ?S; math:remainder ?U.
    ((32 (2 ?N)!math:product (2 ?S)!math:product ?R!math:negation ?U!math:negation)!math:sum 7) math:remainder ?V.
    ((?J (11 ?R)!math:product (22 ?V)!math:product)!math:sum 451) math:integerQuotient ?W.
    ((?R ?V (7 ?W)!math:product!math:negation 114)!math:sum 31) math:integerQuotient ?X; math:remainder ?Z.
    (?Z 1) math:sum ?DAY.
} => {
    (?DAY ?X) :easterFor ?Y.
}.
