Calculator
Use one main number, then optionally compare extra numbers in batch mode. The page keeps a single-column flow, while fields use a responsive grid.
Formula used
If a number n > 1 has prime factorization n = p1a1 × p2a2 × ... × pkak, then the largest prime factor is the biggest prime among p1, p2, ..., pk.
This calculator uses optimized trial division:
- Remove factor 2 until the number becomes odd.
- Test odd divisors from 3 upward.
- Whenever a divisor works, divide repeatedly and record its exponent.
- When the remaining value becomes prime, that final value is the largest prime factor.
How to use this calculator
- Enter a positive integer greater than or equal to 2 in the main number field.
- Add optional batch values if you want comparison rows in the output table.
- Enable worked steps when you want a teaching-friendly breakdown.
- Press Calculate Largest Prime Factor.
- Read the summary above the form, inspect the factorization, and review the Plotly chart.
- Use the CSV and PDF buttons to save the computed results.
Example data table
| Input Number | Prime Factorization | Largest Prime Factor | Classification |
|---|---|---|---|
| 84 | 22 × 3 × 7 | 7 | Composite |
| 13,195 | 5 × 7 × 13 × 29 | 29 | Composite |
| 97 | 97 | 97 | Prime |
| 360 | 23 × 32 × 5 | 5 | Composite |
| 2,310 | 2 × 3 × 5 × 7 × 11 | 11 | Composite |
FAQs
1. What is a largest prime factor?
It is the biggest prime number that divides a given integer exactly. For 84, the prime factors are 2, 3, and 7, so the largest prime factor is 7.
2. Does every integer have a largest prime factor?
Every integer greater than 1 has at least one prime factor. The number 1 is the exception because it has no prime factors at all.
3. What happens when the input itself is prime?
If the input is prime, the number is its own largest prime factor. For example, 97 has no smaller prime divisors, so the result is 97.
4. Why does the method test divisors only up to the square root?
If a composite number has a factor larger than its square root, it must also have a smaller paired factor below that square root. That shortcut reduces unnecessary checks.
5. Can I analyze several numbers at once?
Yes. Enter one main number, then add more values in the batch box using commas, spaces, or new lines. The results table will compare them together.
6. Is this calculator useful for homework and audits?
Yes. Worked steps help with learning, while the factor table, chart, and exports make it useful for reviews, documentation, and quick validation tasks.
7. What do the CSV and PDF buttons export?
They export the computed result table shown on the page. The PDF also includes the main summary values, which is helpful for reports or recordkeeping.
8. Can Excel find a largest prime factor too?
Yes, but it usually needs helper formulas, Power Query, or VBA for a smooth workflow. This page gives faster direct output, plus charting and export tools.
Notes
This calculator is designed for positive integers within the server integer range.
For reusable deployment, save this file as largest_prime_factor_c.php.