Class UInt16Extensions
Extension methods for
Inheritance
Namespace: X10D.Math
Assembly: X10D.dll
Syntax
public static class UInt16Extensions : object
Methods
| Improve this Doc View SourceCountDigits(UInt16)
Returns the number of digits in the current 16-bit signed integer.
Declaration
public static int CountDigits(this ushort value)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | value | The value whose digit count to compute. |
Returns
Type | Description |
---|---|
System.Int32 | The number of digits in |
DigitalRoot(UInt16)
Computes the digital root of the current 16-bit unsigned integer.
Declaration
public static ushort DigitalRoot(this ushort value)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | value | The value whose digital root to compute. |
Returns
Type | Description |
---|---|
System.UInt16 | The digital root of |
Remarks
The digital root is defined as the recursive sum of digits until that result is a single digit.
For example, the digital root of 239 is 5: 2 + 3 + 9 = 14
, then 1 + 4 = 5
.
Factorial(UInt16)
Returns the factorial of the current 16-bit unsigned integer.
Declaration
public static ulong Factorial(this ushort value)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | value | The value whose factorial to compute. |
Returns
Type | Description |
---|---|
System.UInt64 | The factorial of |
GreatestCommonFactor(UInt16, UInt16)
Calculates the greatest common factor between the current 16-bit unsigned integer, and another 16-bit unsigned integer.
Declaration
public static ushort GreatestCommonFactor(this ushort value, ushort other)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | value | The first value. |
System.UInt16 | other | The second value. |
Returns
Type | Description |
---|---|
System.UInt16 | The greatest common factor between |
IsEven(UInt16)
Returns a value indicating whether the current value is evenly divisible by 2.
Declaration
public static bool IsEven(this ushort value)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | value | The value whose parity to check. |
Returns
Type | Description |
---|---|
System.Boolean | true if |
IsOdd(UInt16)
Returns a value indicating whether the current value is not evenly divisible by 2.
Declaration
public static bool IsOdd(this ushort value)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | value | The value whose parity to check. |
Returns
Type | Description |
---|---|
System.Boolean | true if |
IsPrime(UInt16)
Returns a value indicating whether the current value is a prime number.
Declaration
public static bool IsPrime(this ushort value)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | value | The value whose primality to check. |
Returns
Type | Description |
---|---|
System.Boolean | true if |
LowestCommonMultiple(UInt16, UInt16)
Calculates the lowest common multiple between the current 16-bit unsigned integer, and another 16-bit unsigned integer.
Declaration
public static ushort LowestCommonMultiple(this ushort value, ushort other)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | value | The first value. |
System.UInt16 | other | The second value. |
Returns
Type | Description |
---|---|
System.UInt16 | The lowest common multiple between |
MultiplicativePersistence(UInt16)
Returns the multiplicative persistence of a specified value.
Declaration
public static int MultiplicativePersistence(this ushort value)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | value | The value whose multiplicative persistence to calculate. |
Returns
Type | Description |
---|---|
System.Int32 | The multiplicative persistence. |
Remarks
Multiplicative persistence is defined as the recursive digital product until that product is a single digit.
Wrap(UInt16, UInt16)
Wraps the current 16-bit unsigned integer between 0 and a high value.
Declaration
public static ushort Wrap(this ushort value, ushort length)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | value | The value to wrap. |
System.UInt16 | length | The exclusive upper bound. |
Returns
Type | Description |
---|---|
System.UInt16 | The wrapped value. |
Wrap(UInt16, UInt16, UInt16)
Wraps the current 16-bit unsigned integer between a low and a high value.
Declaration
public static ushort Wrap(this ushort value, ushort low, ushort high)
Parameters
Type | Name | Description |
---|---|---|
System.UInt16 | value | The value to wrap. |
System.UInt16 | low | The inclusive lower bound. |
System.UInt16 | high | The exclusive upper bound. |
Returns
Type | Description |
---|---|
System.UInt16 | The wrapped value. |