Fermat Factorization Calculator
Enter an odd number to factor it with Fermat's method.
Result
How to use
- Enter your values in the fields above.
- Press Calculate to see your result instantly.
- Use the Share button to copy a link to your result.
About this calculator
Fermat's factorization method exploits the fact that any odd integer N can be written as a difference of two squares, N = a² − b² = (a−b)(a+b). The algorithm starts at a = ⌈√N⌉ and increases a by 1 each step, checking whether a² − N is itself a perfect square (b²); the moment it is, N factors immediately into (a−b)(a+b). This calculator runs that loop and shows every step it took to find the factors.
The method converges in very few steps when N's two factors are close together — its main weakness is also its most important real-world use: cryptography students and security researchers use Fermat factorization to demonstrate why RSA moduli must be built from primes that are far apart, since primes chosen too close together make the modulus trivially breakable. It's also a standard exercise in number theory coursework for illustrating difference-of-squares reasoning.
Was this helpful?
Popular calculators
Loan Calculator
Monthly payment, total interest and full amortization schedule.
Percentage Calculator
Percent change, percent of, and ratio calculations.
Discount Calculator
Calculate final price, savings, and discount amount.
BMI Calculator
Body mass index from height and weight (metric or imperial).
Age Calculator
Compute your exact age in years, months and days from a birth date.
Compound Interest Calculator
Calculate the final amount and interest earned with compounding.
All Calculators
No calculators found
Comments (0)