java.lang.Cloneable
, java.lang.Comparable<Ifactor>
public class Ifactor extends java.lang.Object implements java.lang.Cloneable, java.lang.Comparable<Ifactor>
Modifier and Type | Field | Description |
---|---|---|
java.math.BigInteger |
n |
The standard representation of the number
|
static Ifactor |
ONE |
|
java.util.Vector<java.lang.Integer> |
primeexp |
|
static Ifactor |
ZERO |
Constructor | Description |
---|---|
Ifactor(int number) |
Constructor given an integer.
|
Ifactor(Ifactor oth) |
Copy constructor.
|
Ifactor(java.math.BigInteger number) |
Constructor given a BigInteger .
|
Ifactor(java.util.Vector<java.lang.Integer> pows) |
Constructor given a list of exponents of the prime factor decomposition.
|
Modifier and Type | Method | Description |
---|---|---|
Ifactor |
add(java.math.BigInteger oth) |
Summation with another positive integer
|
int |
bigomega() |
The sum of the prime factor exponents, with multiplicity.
|
Ifactor |
clone() |
Deep copy.
|
int |
compareTo(Ifactor oth) |
Compare value against another Ifactor
|
java.math.BigInteger |
core() |
The square-free part.
|
Ifactor |
divide(Ifactor oth) |
Integer division through another positive integer.
|
java.util.Vector<java.math.BigInteger> |
divisors() |
The set of positive divisors.
|
Ifactor |
dropPrime() |
Divide through the highest possible power of the highest prime.
|
boolean |
equals(Ifactor oth) |
Comparison of two numbers.
|
Ifactor |
gcd(Ifactor oth) |
Greatest common divisor of this and oth.
|
boolean |
issquare() |
Test whether this is a square of an integer (perfect square).
|
Ifactor |
lcm(Ifactor oth) |
Lowest common multiple of this with oth.
|
static void |
main(java.lang.String[] args) |
Test program.
|
Ifactor |
max(Ifactor oth) |
Maximum of two values.
|
static Ifactor |
max(java.util.Vector<Ifactor> set) |
Maximum of a list of values.
|
Ifactor |
min(Ifactor oth) |
Minimum of two values.
|
static Ifactor |
min(java.util.Vector<Ifactor> set) |
Minimum of a list of values.
|
int |
moebius() |
The Moebius function.
|
protected Ifactor |
multGcdLcm(Ifactor oth,
int type) |
Multiply with another positive integer.
|
Ifactor |
multiply(int oth) |
Multiply with another positive integer.
|
Ifactor |
multiply(Ifactor oth) |
Multiply with another positive integer.
|
Ifactor |
multiply(java.math.BigInteger oth) |
Multiply with another positive integer.
|
int |
omega() |
The sum of the prime factor exponents, without multiplicity.
|
Ifactor |
pow(int exponent) |
Exponentiation with a positive integer.
|
Rational |
root(int r) |
Pulling the r-th root.
|
Ifactor |
sigma() |
Sum of the divisors of the number.
|
Ifactor |
sigma(int k) |
Sum of the k-th powers of divisors of the number.
|
java.lang.String |
toString() |
Convert to printable format
|
public java.math.BigInteger n
public java.util.Vector<java.lang.Integer> primeexp
public static final Ifactor ONE
public static final Ifactor ZERO
public Ifactor(int number)
number
- the standard representation of the integerpublic Ifactor(java.math.BigInteger number)
number
- the BigInteger representation of the integerpublic Ifactor(java.util.Vector<java.lang.Integer> pows)
pows
- the vector with the sorted list of exponents.
pows[0] is the exponent of 2, pows[1] the exponent of 3, pows[2] the exponent of 5 etc.
Note that this list does not include the primes, but assumes a continuous prime-smooth basis.public Ifactor(Ifactor oth)
oth
- the value to be copiedpublic Ifactor clone()
clone
in class java.lang.Object
public boolean equals(Ifactor oth)
oth
- the number to compare this with.public Ifactor multiply(java.math.BigInteger oth)
oth
- the second factor.public Ifactor multiply(int oth)
oth
- the second factor.public Ifactor multiply(Ifactor oth)
oth
- the second factor.public Ifactor lcm(Ifactor oth)
oth
- the second parameter of lcm(this,oth)public Ifactor gcd(Ifactor oth)
oth
- the second parameter of gcd(this,oth)protected Ifactor multGcdLcm(Ifactor oth, int type)
oth
- the second factor.type
- 0 to multiply, 1 for gcd, 2 for lcmpublic Ifactor divide(Ifactor oth)
oth
- the denominator.public Ifactor add(java.math.BigInteger oth)
oth
- the other term.public Ifactor pow(int exponent) throws java.lang.ArithmeticException
exponent
- the non-negative exponentjava.lang.ArithmeticException
public Rational root(int r) throws java.lang.ArithmeticException
r
- the positive or negative (nonzero) root.java.lang.ArithmeticException
public java.util.Vector<java.math.BigInteger> divisors()
public Ifactor sigma()
public Ifactor sigma(int k)
public Ifactor dropPrime()
public boolean issquare()
public int bigomega()
public int omega()
public java.math.BigInteger core()
public int moebius()
public Ifactor max(Ifactor oth)
oth
- the number to compare this with.public Ifactor min(Ifactor oth)
oth
- the number to compare this with.public static Ifactor max(java.util.Vector<Ifactor> set)
set
- list of numbers.public static Ifactor min(java.util.Vector<Ifactor> set)
set
- list of numbers.public int compareTo(Ifactor oth)
compareTo
in interface java.lang.Comparable<Ifactor>
oth
- The value to be compared agains.public java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception