Click or drag to resize

primeFactorsPrimefactors Method (Int32)

Get the prime factors of a number.

Namespace:  NumberStone
Assembly:  WhetStone (in WhetStone.dll) Version: 1.0.4.0 (1.0.0.0)
Syntax
C#
public static IEnumerable<int> Primefactors(
	this int x
)

Parameters

x
Type: SystemInt32
The number to find factors of.

Return Value

Type: IEnumerableInt32
All the prime factors of x.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Int32. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Remarks

If a prime divides x more than once, it will be returned multiple times.

The returned primes will be sorted in ascending order.

See Also