I suggest you use the function 'nthroot' instead of '^(1/3)'. RaIsing to a fractional exponent may sometimes give inaccurate answers. For example 'floor(64^(1/3))' yields '3', which is obviously wrong.
You can test your sum of square roots implementation by answering this: https://www.mathworks.com/matlabcentral/cody/problems/53930-easy-sequences-65-fractional-part-of-square-roots