IntegerMath.Factorize Method

Definition

Namespace: Extreme.Mathematics
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23

Overload List

Factorize(Int32) Returns the prime factors of an integer.
Obsolete.
Factorize(Int64) Returns the prime factors of a long (64-bit) integer.
Obsolete.

Factorize(Int32)

Note: This API is now obsolete.
Returns the prime factors of an integer.
C#
[ObsoleteAttribute("Use the factor method instead.")]
public static int[] Factorize(
	int n
)

Parameters

n  Int32
An integer greater than zero.

Return Value

Int32[]
An integer array containing the prime factors of n in ascending order.

Remarks

This method uses a simple trial divide algorithm to look for small prime factors. It then switches to Pollard's Rho algorithm to find any large prime factors of n with the known factors divided out. If this number is prime, the algorithm may take a long term to finish.

Exceptions

ArgumentOutOfRangeExceptionn is less than or equal to zero.

Factorize(Int64)

Note: This API is now obsolete.
Returns the prime factors of a long (64-bit) integer.
C#
[ObsoleteAttribute("Use the factor method instead.")]
public static long[] Factorize(
	long n
)

Parameters

n  Int64
A 64-bit integer greater than zero.

Return Value

Int64[]
A 64-bit integer array containing the prime factors of n in ascending order.

Remarks

This method uses a simple trial divide algorithm to look for small prime factors. It then switches to Pollard's Rho algorithm to find any large prime factors of n with the known factors divided out. If this number is prime, the algorithm may take a long term to finish.

This method breaks down when the Rho algorithm is invoked for values larger than 248. No further decomposition is attempted. Instead, this number is returned as the last factor.

Exceptions

ArgumentOutOfRangeExceptionn is less than or equal to zero.

See Also