Returns the prime factors of a long (64-bit) integer.
Namespace:
Extreme.Mathematics
Assembly:
Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.1
public static long[] Factorize(
long n
)
Public Shared Function Factorize (
n As Long
) As Long()
public:
static array<long long>^ Factorize(
long long n
)
static member Factorize :
n : int64 -> int64[]
Parameters
- n
- Type: SystemInt64
A 64-bit integer greater than zero.
Return Value
Type:
Int64A 64-bit integer array containing the prime factors
of
n in ascending order.
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.
Reference