# factor

factor(n) -> Dict

Compute the prime factorization of an integer `n`. Returns a dictionary. The keys of the dictionary correspond to the factors, and hence are of the same type as `n`. The value associated with each key indicates the number of times the factor appears in the factorization.

``````julia> factor(100) # == 2*2*5*5
Dict{Int64,Int64} with 2 entries:
2 => 2
5 => 2``````

## Examples

1. Factorize an integer:

``````julia> factor(100)
Dict{Int64, Int64} with 2 entries:
2 => 2
5 => 2``````

This example calculates the prime factorization of the integer 100 and returns a dictionary where the keys represent the factors and the values indicate the number of times each factor appears in the factorization.

2. Factorize a large number:

``````julia> factor(9876543210)
Dict{Int64, Int64} with 4 entries:
2 => 1
3 => 2
5 => 1
3607 => 1``````

It computes the prime factorization of a large number (9876543210 in this case) and returns a dictionary with the prime factors and their multiplicities.

3. Factorize a prime number:
``````julia> factor(17)
Dict{Int64, Int64} with 1 entry:
17 => 1``````

When a prime number is provided, the function returns a dictionary with only one entry representing the prime factor itself.

Common mistake example:

``````julia> factor(0)
ERROR: DomainError("0 is not a positive integer.")``````

In this example, the input provided is not a positive integer, which results in a `DomainError`. The `factor` function expects a positive integer as input. Make sure to provide a valid positive integer to avoid such errors.