# Calculate prime factorization (JavaScript)

## Program

## Description

This JavaScript program calculates the prime factorization of the given integer. The number must be between 2 and 2^{53}.

If the number is very large, the program may hang for a few seconds. This is because the worst-case running time for the number `n` is `O`(√`n`). The algorithm being used is just simple trial division, with a small optimization of skipping even numbers.

The source code is available for viewing.

## Examples

- 7 = 7 (prime)
- 12 = 2 × 2 × 3 = 2
^{2}× 3 - 9007199254740881 = 9007199254740881 (largest prime number in range; slow)

## More info

- MathWorld: Prime Factorization
- Wikipedia: Trial division
- The Prime Glossary: Trial division
- The Prime Glossary: Wheel factorization