Update sum_of_squares.py

This commit is contained in:
Byte Bender 2024-10-10 10:28:50 +05:30 committed by GitHub
parent 37c0953597
commit 78849a7437
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,6 +4,8 @@ This script demonstrates the implementation of the sum of squares of the first n
The function takes an integer n as input and returns the sum of squares
from 1 to n using the formula n(n + 1)(2n + 1) / 6. This formula computes the sum efficiently
without the need for iteration.
https://www.cuemath.com/algebra/sum-of-squares/
"""
def sum_of_squares(n: int) -> int: