Project Euler Solutions by Ross Marks

<?php
/*****************************
 * ProjectEuler - Problem 15
 * By Ross Marks
 *****************************
 * Starting in the top left corner of a 2×2 grid, and only being able to move to the right and down, there are exactly 6 routes to the bottom right corner.
 * 
 * How many such routes are there through a 20×20 grid?
 ****************************/
$no 1;
$gridsize 20;

for (
$i 0$i $gridsize$i++){
  
$no *= ($gridsize) - $i;
  
$no /= $i +1;
}

echo 
"result: $no";

/*
Notes:

Paths as a series of Ds and Rs. 
In 2×2 grid all paths are 1) DDRR 2) DRDR 3) DRRD 4) RDRD 5) RDDR 6) RRDD.

all paths = 2N containing N Rs & N Ds.
If we have 2N empty spaces and place all Rs, then the placement of the Ds are given
SO

how many ways can N out of 2N possible places?
*/

?>