Project Euler Solutions by Ross Marks

<?php
/*****************************
 * ProjectEuler - Problem 6
 * By Ross Marks
 *****************************
 * The sum of the squares of the first ten natural numbers is,
 *
 * 12 + 22 + ... + 102 = 385
 * The square of the sum of the first ten natural numbers is,
 *
 * (1 + 2 + ... + 10)2 = 552 = 3025
 * Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 − 385 = 2640.
 *
 * Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.
 ****************************/

$sumofsquares 0;
for(
$no 1$no <= 100$no++){
    
$sumofsquares += bcpow($no2);
}

$squareofsum 0;
for(
$no 1$no <= 100$no++){
    
$squareofsum += $no;
}
$squareofsum bcpow($squareofsum2);
echo 
"Awnser: $squareofsum - $sumofsquares = ".($squareofsum $sumofsquares);

?>