Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

numlib::sumdivisors

Sum of divisors of an integer

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

Syntax

numlib::sumdivisors(n)

Description

numlib::sumdivisors(n) returns the sum of the positive divisors of the integer n.

numlib::sumdivisors(0) returns 0.

numlib::sumdivisors returns the function call with evaluated argument if the argument is not a number.

numlib::sumdivisors returns an error if the argument evaluates to a number of wrong type.

numlib::sumdivisors(n) is the same as numlib::sigma(n, 1).

Examples

Example 1

The sum of the positive divisors of 120 is 360:

numlib::sumdivisors(120)

Example 2

The sum of the positive divisors of - 63 is 104:

numlib::sumdivisors(-63)

Parameters

n

An integer

Return Values

numlib::sumdivisors(n) returns a nonnegative integer.

Algorithms

Internally, ifactor is used for factoring n.

Was this topic helpful?