Prime Factors of n! + 1

Prime Factors of n! + 1

ISEF Category: Mathematics

Ready to Turn This Idea Into a Real Project?

This guide was put together with the help of AI research tools to give you a solid starting point. But a competitive science fair project lives in the details: refining your research question, fine-tuning your variables, analyzing your data, and presenting your findings like a seasoned scientist.

For next steps tailored to your interests, skill level, and timeline, work one-on-one with a MehtA+ mentor. Learn more about MehtA+ Science & Engineering Research Mentorship →

Subcategory: Number Theory  ·  Difficulty: Advanced  ·  Setup: Home Setup  ·  Time: 1 to 2 Months

The Hook

What happens when you add one to a factorial, the number that grows faster than almost anything you have seen in school? You get a number that hides prime factors in a very tricky way. This project asks how many different primes must divide n! + 1. You can test patterns with computation and compare them to a number theory heuristic.

What Is It?

A factorial, written n!, means 1 × 2 × 3 × ... × n. So n! already contains every prime factor up to n. When you add 1, none of those primes can divide the result, because dividing n! by any number from 2 to n leaves no remainder, and adding 1 breaks that divisibility.

That leaves you with a new number that must be built from primes larger than n, or from primes that behave in a special way. Think of it like a giant LEGO tower where every block up to size n is already used. Then you add one extra block, and the structure has to snap together in a completely new way. Your job is to count how many distinct prime factors appear, then ask how that count changes as n grows.

A lower bound means a guaranteed minimum. If a paper or heuristic claims that n! + 1 should usually have at least a certain number of distinct prime factors, you can test that claim computationally for many values of n. You can also look for exceptions, clusters, or growth trends that make the pattern clearer.

Why This Is a Good Topic

This is a strong science fair topic because you can ask a precise question, generate your own data, and use real mathematical reasoning. The problem connects to prime factorization, modular arithmetic, and probabilistic number theory, so you are doing real math, not just plotting random numbers. You can compute results at home with open-source tools, then compare them to a heuristic model and see whether the data supports it.

Research Questions

  • How does the number of distinct prime factors of n! + 1 change as n increases from 1 to 200?
  • What is the effect of restricting n to primes, composites, or factorial-rich values on the distinct prime factor count of n! + 1?
  • Does the count of distinct prime factors of n! + 1 grow faster, slower, or about the same as a simple logarithmic model predicts?
  • To what extent do the observed values for n! + 1 match a probabilistic number theory heuristic for distinct prime factors?
  • Which values of n up to 200 produce unusually many or unusually few distinct prime factors in n! + 1?
  • How does the largest prime factor of n! + 1 compare with n for the same range of n?
  • What is the effect of using a refined lower bound that depends on congruence patterns of n! + 1?

Basic Materials

  • A laptop or desktop computer with Python installed.
  • A spreadsheet program such as Google Sheets or LibreOffice Calc.
  • A free computer algebra system such as SageMath or PARI/GP.
  • A notebook for tracking computed values and conjectures.
  • Internet access for checking prime factorizations and reading references.
  • A calculator for quick sanity checks.

Advanced Materials

  • A university or advanced school computer with more memory for larger integer computations.
  • Python with SymPy, SageMath, or PARI/GP for integer factorization and modular arithmetic.
  • Access to mathematical databases such as OEIS and arXiv for background comparison.
  • A compiled math package or cloud notebook for batching many factorizations.
  • Version control software such as Git for recording code changes and result tables.

Software & Tools

  • Python: Computes factorials, factors integers, and automates the search for patterns.
  • SageMath: Handles exact arithmetic and number theory functions for large integers.
  • PARI/GP: Factors large integers and tests conjectures quickly.
  • Google Sheets: Organizes output tables and helps you spot trends in the counts.
  • ImageJ: Not needed for this topic, so skip visual analysis tools and focus on exact arithmetic.

Experiment Steps

  1. Define the exact quantity you want to study, such as the number of distinct prime factors of n! + 1.
  2. Choose a range of n and decide whether you will test every value or sample special families of n.
  3. Build a computation pipeline that finds n! + 1 and factors it reliably for each n in your range.
  4. Record the distinct prime factor count, the largest prime factor, and any congruence patterns you want to compare.
  5. Fit your data against a simple heuristic or lower-bound model, then check where the model matches or fails.
  6. Stress-test your claim on more values of n and write down the exceptions, since those often matter most.

Common Pitfalls

  • Forgetting that n! + 1 can become very large very quickly, which makes naive factoring slow or impossible.
  • Counting repeated prime powers as separate factors, when the question asks for distinct prime factors only.
  • Using floating-point arithmetic instead of exact integers, which can corrupt factorial computations.
  • Comparing raw counts without normalizing for the growth of n, which hides the real trend.
  • Treating one surprising exception as proof, when a strong number theory claim needs a broader dataset.

What Makes This Competitive

A competitive version goes past a simple table of factorizations. You build a clear heuristic, test it against many values, and explain where the heuristic succeeds or breaks. Strong projects also compare more than one model, use careful computational checks, and look for patterns that are not obvious from a few examples. A sharp lower bound, paired with clean data and honest exceptions, can make the project feel much deeper.

Project Variations

  • Study the same question for n! - 1 instead of n! + 1, then compare the factor patterns.
  • Replace n! with primorials or double factorials and test whether the distinct prime factor count changes.
  • Focus on the largest prime factor of n! + 1 and ask whether it follows a separate growth law.

Learn More

  • MIT OpenCourseWare Number Theory: Search the MIT OpenCourseWare site for undergraduate number theory lecture notes and problem sets.
  • OEIS: Search for sequences related to factorial plus one and prime factor counts.
  • arXiv: Search for papers on factorial primes, Brocard-like problems, and probabilistic number theory.
  • MathWorld: Read background entries on factorials, prime factors, and related conjectures.
  • PubMed: Not a main source for this topic, but useful only if you need examples of statistical modeling language from other fields.
Shopping Cart