#!/usr/bin/perl -w
# -------------------------------------------------------
# Easter dates 1700-2199
# -------------------------------------------------------
#
# 1998-07-13 Mario Hilgemeier hilgemeier(put an at here)gmx.de
# o Easter formula by Gauss, ISO date output
# o tested for 1999 - 2003 with http://www.pauahtun.org/cgi-bin/easter.py

$year = $ARGV[0]; # year

if ($year >= 1700 && $year <= 1799) { $m = 23; $n = 3; }
if ($year >= 1800 && $year <= 1899) { $m = 23; $n = 4; }
if ($year >= 1900 && $year <= 2099) { $m = 24; $n = 5; }
if ($year >= 2100 && $year <= 2199) { $m = 24; $n = 6; }
#  you probably won't need more ... ;-)

# compute modules:
$a = $year % 19;
$b = $year % 4;
$c = $year % 7;
$d = ((19 * $a) + $m) % 30;
$e = ((2 * $b) + ( 4 * $c) + (6 * $d) + $n) % 7;

$day = (22 + $d + $e);	#  Easter in March
if ($day > 31) #  Easter in April
{
  $day = ($d + $e - 9);
  $month = 4;
  if ($day > 24)
  {
    if ($day == 26) { $day = 19; }
    if ($day == 25 && $d == 28 && $a > 10) { $day = 18; }
  }
}
else
{
  $month = 3;
}
$month = "0".$month; # always 3 or 4
if (length($day) < 2) { $day = "0".$day; }
print STDOUT "Easter Sunday (Gregorian): $year-$month-$day\n";
print STDOUT "----------------------------------------\n";