The maximum sum of squares - MATLAB Cody - MATLAB Central

Problem 44554. The maximum sum of squares

Difficulty:Rate
Create a function file with an input maxval to determine the maximum number of terms for the series 1^2 + 2^2 + 3^2 + ... such that the sum is <= maxval. The function should return the number of terms. The function should return 13 when maxval=1000.

Solution Stats

52.13% Correct | 47.87% Incorrect
Last Solution submitted on May 10, 2025

Problem Comments

Solution Comments

Show comments
Join Cody Contest 2025 — Have Fun and Win Prizes!
...
We’re excited to invite you to Cody Contest 2025! 🎉 Pick a team,...
Dive Into Hands-On Learning at MATLAB EXPO 2025 – Register Now!
Get ready to roll up your sleeves at MATLAB EXPO 2025 –...
2

Problem Recent Solvers44

Suggested Problems

Problem Tags

sum

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!