juggernaut.mef
public class Numbers extends Object
Field Summary | |
---|---|
static double | PHI |
Method Summary | |
---|---|
static String | convBase(String n, int base1, int base2) |
static int | factorial(int n)
Returns the factorial of x which is the product of the integers from 1 to x. |
static double | fPart(double n)
Returns the fraction or decimal component of a {@code double}. |
static float | fPart(float n)
Returns the fraction or decimal component of a {@code float}. |
static int | nCr(int n, int r)
Returns the number of ways to choose r objects among n choices without respect to order. |
static int | nDigits(int n)
Returns the number of digits in a given {@code int}. |
static int | nDigits(int n, int base)
Returns the number of digits in a specified base of a base 10 number. |
static int | nPr(int n, int r)
Returns the number of ways to choose r objects among n choices with respect to order. |
static long[] | pascal(int r)
Returns the specified row of Pascal's triangle. {@code pascal(0)} = [1], {@code pascal(1)} = [1 1], {@code pascal(2)} = [1 2 1], {@code pascal(3)} = [1 3 3 1], etc. |
static String | toBase(int n, int base) |
static int | toBase10(String n, int base) |
static int[] | toDigits(int n) |
Returns: x! (x factorial)
Parameters: n the number
Returns: The decimal part of the number.
Parameters: n the number
Returns: The decimal part of the number.
Parameters: n the total number of objects r the amount to choose
Returns: The number of of ways to choose r objects among n choices.
Parameters: n a double
Returns: The number of digits in the integer.
Parameters: n the number base the base
Returns: The number of digits of the number in that base.
Parameters: n the total number of objects r the amount to choose
Returns: The number of of ways to choose r objects among n choices.
Parameters: r the number row of Pascal's triangle
Returns: The row of Pascal's triangle.