MAT

Riddle #7

Find the difference between the square of the sum of the numbers 1 to N and the sum of their squares.

Constraints

1 < N < 104

Example

The square of the sum of the numbers from 1 to N = 10 is 552 while the sum of their squares is 385. The difference between the two numbers is:

2640

Your program

<?php
    
function main($N) {

  $return = 0;
  /* Write your function here */
  
  return $return;
}
  
$IN = (array) json_decode(base64_decode($argv[1]));
extract($IN);
echo main($N);
?>

Your input

{ 
  "N": 10 
}

Your output

-

Correct output

2640

0 0 votes
Article Rating
Notifiche
Notificami
0 Comments
Inline Feedbacks
View all comments