Skip to content

FactorAlgorithmBase#factor() don't add BigInteger.ONE #1

@axkr

Description

@axkr

In FactorAlgorithmBase don't add BigInteger.ONE as factor only add prime factors:

	public SortedMultiset<BigInteger> factor(BigInteger N) {
		SortedMultiset<BigInteger> factors = new SortedMultiset_BottomUp<BigInteger>();
		// first get rid of case |N|<=1:
		if (N.abs().compareTo(I_1)<=0) {
			if (!N.equals(BigInteger.ONE)) {
				factors.add(N);
			}
			return factors;
		}
		// make N positive:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions