Skip to content

Instantly share code, notes, and snippets.

@chimericdream
Created November 24, 2016 05:18
Show Gist options
  • Save chimericdream/a97ac90dced1245c6546bf1db67ea52e to your computer and use it in GitHub Desktop.
Save chimericdream/a97ac90dced1245c6546bf1db67ea52e to your computer and use it in GitHub Desktop.
Project Euler - Problem #28
21 22 23 24 25
20 7 8 9 10
19 6 1 2 11
18 5 4 3 12
17 16 15 14 13
$total = 1;
for ($i = 2; $i <= 1001; $i++) {
$total += ($i % 2) ? pow($i, 2) : 3 _ pow($i, 2) + 3;
}
echo $total;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment