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.
Hi, DP. You have created a nice problem here: well done. Could you please clarify/check/amend one detail though. In the Problem Statement it stipulates the sum must be that "less than" maxval. So if maxval=1, then the series would have no terms (hence sum=0); alternatively, if it had one term, then the sum (1²=1) would be "less than or equal to" maxval, as implied in the Test Suite. Thanks, DIV
Thanks for the clarification!
This submission has evidently been copied from 'somewhere', because it is _identical_ to Solution 1499384 (submitted on 21 Apr 2018 by J. S. Kowontan). It would be good professional practice to _at least_ acknowledge the source. Moreover I don't see the point of submitting a verbatim copy of somebody else's solution; it does not bring any credit. —DIV
Knight's Tour Checker
Omit columns averages from a matrix
Add two numbers
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office