freeCodeCamp/curriculum/challenges/russian/08-coding-interview-prep/project-euler/problem-6-sum-square-differ...

1.8 KiB

id challengeType title videoUrl localeTitle
5900f3721000cf542c50fe85 5 Problem 6: Sum square difference Задача 6: Суммарный квадрат

Description

Сумма квадратов первых десяти натуральных чисел равна,
1 2 + 2 2 + ... + 10 2 = 385
Квадрат суммы первых десяти натуральных чисел есть,
(1 + 2 + ... + 10) 2 = 55 2 = 3025
Следовательно, разница между суммой квадратов первых десяти натуральных чисел и квадратом суммы равна 3025 - 385 = 2640. Найдите разницу между суммой квадратов первых n натуральных чисел и квадратом суммы.

Instructions

undefined

Tests

tests:
  - text: ''
    testString: 'assert.strictEqual(sumSquareDifference(10), 2640, "<code>sumSquareDifference(10)</code> should return 2640.");'
  - text: ''
    testString: 'assert.strictEqual(sumSquareDifference(20), 41230, "<code>sumSquareDifference(20)</code> should return 41230.");'
  - text: ''
    testString: 'assert.strictEqual(sumSquareDifference(100), 25164150, "<code>sumSquareDifference(100)</code> should return 25164150.");'

Challenge Seed

function sumSquareDifference(n) {
  // Good luck!
  return true;
}

sumSquareDifference(100);

Solution

// solution required