Number theory coding challenges

Practise number theory with 41 coding challenges, from easy to hard. Every challenge runs in your browser with instant tests, an AI review of your code and community solutions to compare.

Easy · 12 Medium · 26 Hard · 3

Skills you'll practise: Sieve of EratosthenesBig number arithmeticPrimality testingModular arithmeticPrime factorizationSquare root boundCycle detectionDigit manipulationDivisor pairsMemoizationPair enumerationTrial division
  • Python · C++ · C#
  • Automated tests
  • AI code review
  • Community solutions
341
Challenges
245
Solutions shared
9
Languages

All challenges

Search by name or topic, or filter by difficulty.

41 challenges
Hard

Non-Abundant Sums

Add up the numbers up to a limit that cannot be written as the sum of two abundant numbers.

You'll learn Divisor sievePair enumeration
AdvancedCompetitive-programmingNumber-theoryPrimesProject Euler stylemath
No solutions yet
Medium

Sum of Big Numbers

Add up a list of numbers too long for any built-in integer type.

You'll learn Big number arithmeticString processing
Big integersCompetitive-programmingIntermediateNumber-theoryProject Euler stylemath
No solutions yet
Medium

Pentagonal Pair

Count pairs of pentagonal numbers whose sum is pentagonal too.

You'll learn Integer square rootsPair enumeration
Competitive-programmingIntermediateNumber-theoryProject Euler stylemath
No solutions yet
Easy

Sum of Proper Divisors

Add up every divisor of n that is smaller than n.

You'll learn Divisor pairsSquare root bound
BeginnerCS1High schoolLoopsNumber-theoryNumbersPrimesmath
No solutions yet
Medium

Highly Divisible Triangular Number

Find the first triangular number that has at least d divisors.

You'll learn Prime factorizationDivisor counting
Competitive-programmingIntermediateNumber-theoryProject Euler stylemath
No solutions yet