Skip to content

Instantly share code, notes, and snippets.

@ikarius6
Last active September 13, 2019 21:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ikarius6/be5f71286e737d47ffda81cc95bd498c to your computer and use it in GitHub Desktop.
Save ikarius6/be5f71286e737d47ffda81cc95bd498c to your computer and use it in GitHub Desktop.
Programmer's day on Friday 13 average years - JSON Voorhees
<?php
//Programmer's day on Friday 13 average years - JSON Voorhees
$r=$i=0;
for ($y=$ly=0; $y<3000; $y++) {
$d = new DateTime();
$d->setDate($y, 1, 256);
if ($d->format("D") == "Fri" && $d->format('d') == 13) {
$r += $y - $ly;
$ly = $y;
$i++;
//echo $y . "<br/>";
}
}
echo $r/$i;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment