PROPDIVS

This function returns all proper divisors of an integer as a sorted one-column table.

Proper divisors are positive divisors that are strictly less than the number itself.

D_{\text{proper}}(n) = \{d \in \mathbb{N} : d \mid n,\ d < n\}

The output is formatted as a 2D array so it can spill correctly in Excel.

Excel Usage

=PROPDIVS(n)
  • n (int, required): Integer whose proper divisors are listed.

Returns (list[list]): One-column 2D array of proper divisors in ascending order.

Example 1: Proper divisors of twenty four

Inputs:

n
24

Excel formula:

=PROPDIVS(24)

Expected output:

Result
1
2
3
4
6
8
12
Example 2: Proper divisors of a prime integer

Inputs:

n
13

Excel formula:

=PROPDIVS(13)

Expected output:

1

Example 3: Proper divisors of one

Inputs:

n
1

Excel formula:

=PROPDIVS(1)

Expected output:

""

Example 4: Proper divisors of a perfect square

Inputs:

n
36

Excel formula:

=PROPDIVS(36)

Expected output:

Result
1
2
3
4
6
9
12
18

Python Code

from sympy import proper_divisors as sympy_proper_divisors

def propdivs(n):
    """
    List proper divisors of an integer.

    See: https://docs.sympy.org/latest/modules/ntheory.html#sympy.ntheory.factor_.proper_divisors

    This example function is provided as-is without any representation of accuracy.

    Args:
        n (int): Integer whose proper divisors are listed.

    Returns:
        list[list]: One-column 2D array of proper divisors in ascending order.
    """
    try:
        if isinstance(n, bool):
            return "Error: n must be an integer"

        n_value = int(n)
        if float(n) != float(n_value):
            return "Error: n must be an integer"

        values = sympy_proper_divisors(n_value, generator=False)
        if not values:
            return [[""]]
        return [[int(value)] for value in values]
    except Exception as e:
        return f"Error: {str(e)}"

Online Calculator

Integer whose proper divisors are listed.