Updated · By Pete Bromfield, former Head of Maths with IB examining experience

IA idea · Pure maths, number & proof

How many primes are there below n? Testing the prime number theorem

AA SLAA HLAI SL Solid Also in: Statistics, Modelling, Cryptography

Research question

How accurately do x/ln x and the logarithmic integral approximate the number of primes below x for x up to 10⁷, and how does the relative error behave?

Make it yours, then agree it with your teacher.

Next step: plan this IA free — the planner opens with this question filled in. For feedback on your own draft, the IA package (€39 once) gives you 5 AI feedback credits and every annotated exemplar in full.

Why it makes a good exploration

Primes look random, yet their count follows a smooth law. Testing the approximations yourself, and measuring how slowly the error shrinks, connects number theory with modelling.

The mathematics you'll need

  • Counting functions and logarithms
  • Relative and absolute error
  • Integration: the logarithmic integral (explain; evaluate numerically)
  • Modelling error against x on log scales

Where the data comes from

Generate primes with a sieve (spreadsheet or program); check counts against OEIS.

A possible outline

  1. Explain the sieve and count primes.
  2. Compare with x/ln x.
  3. Compare with Li(x).
  4. Model the relative error.
  5. Reflect on why the prime number theorem is about ratios, not differences.

Pitfalls that cost marks

  • Code with no explanation.
  • Confusing log bases.
  • Presenting tables without interpretation.

Showing personal engagement

  • Explore twin primes or primes in arithmetic progressions.
  • Make a prediction for 10⁸ and check with published counts.
  • Explain the theorem's history briefly.

See Criterion C: personal engagement for what examiners look for.

Which course is it for?

CourseFitMaths to lean on
AA SLGood fitCounting functions and logarithms; Relative and absolute error
AA HLGood fitCounting functions and logarithms; Relative and absolute error
AI SLGood fitCounting functions and logarithms; Relative and absolute error
AI HLNot a natural fitThe mathematics is mainly from the AA course; an AI HL version would need modelling with technology, statistics or networks at HL level.

Level: Solid. Needs some independent work beyond class examples. See how the IA differs between AA and AI, SL and HL.

How this idea reaches the top bands

Reflection (D)

For this idea, start with the weak points: code with no explanation; and confusing log bases. Say how each one affects your answer.

Use of mathematics (E)

SL: counting functions and logarithms; relative and absolute error; integration: the logarithmic integral (explain; evaluate numerically); modelling error against x on log scales, each explained in your own words and carried out correctly.

How pure maths explorations reach the top bands in general: Pure maths, number & proof IA ideas. Guides: A · B · C · D · E · self-grade sheet.

Taking it further

Investigate the average gap between primes near x and compare with ln x.

Extending it for HL

Add an HL technique the question genuinely needs: what an HL pure maths exploration adds.

Frequently asked questions

Which IB Maths course is this IA idea for?

It works for AA SL, AA HL and AI SL. We rate it Solid: it needs some independent work beyond class examples.

What mathematics does this IA use?

Counting functions and logarithms, relative and absolute error, integration: the logarithmic integral (explain; evaluate numerically) and modelling error against x on log scales.

Where can I get data for this IA?

Generate primes with a sieve (spreadsheet or program); check counts against OEIS. Checked sources and tools: OEIS (On-Line Encyclopedia of Integer Sequences).

Turn this idea into your IA

The planner opens with “How many primes are there below n? Testing the prime number theorem” filled in: the question, the maths and the data sources.

Plan this IA free

Your plan is kept in this browser. A free account keeps it with your drafts on any device: Join free · Sign in

Also: free IA self-check · A–E checklist (PDF) · have a draft? AI feedback or a review with Pete (€100)

Writing it up: how to write a Maths IA, step by step · structure and format · mistakes that cost marks · annotated exemplars, marked on every criterion

Similar ideas

All pure maths ideas · AA SL ideas · AA HL ideas · AI SL ideas · All 239 IA ideas