Numbers coding challenges

Practise numbers with 46 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 · 30 Medium · 15 Hard · 1

Skills you'll practise: DivisibilityConditionsDigit extractionDigit sumLoopsRecurrencesSieve of EratosthenesSquare root boundBit shiftsDivisor pairsLookup tablesModulo
  • 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.

46 challenges
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

Euler's Totient

Count the integers from 1 to n that share no common factor with n.

You'll learn Prime factorizationProduct formula
CS1High schoolIntermediateLoopsNumber-theoryNumbersPrimesmath
No solutions yet
Easy

Happy Number

Decide whether repeatedly summing the squares of the digits of a number reaches 1.

You'll learn Digit extractionCycle detection
BeginnerCS1High schoolLoopsNumbersmath
No solutions yet
Easy

Strong Number

Check whether a number equals the sum of the factorials of its digits.

You'll learn Digit extractionFactorials
BeginnerCS1High schoolLoopsNumbersmath
No solutions yet
Medium

Kaprekar Number

Check whether the square of a d-digit number splits into a left part and a d-digit right part that add up to the number.

You'll learn Splitting numbersPowers of ten
CS1High schoolIntermediateLoopsNumbersmath
No solutions yet
Easy

Automorphic Number

Check whether the square of a number ends with the number itself.

You'll learn Digit comparisonPowers of ten
BeginnerCS1High schoolLoopsNumbersmath
No solutions yet
Easy

Harshad Number

Check whether a number is divisible by the sum of its digits (a Harshad or Niven number).

You'll learn Digit sumDivisibility
BeginnerCS1High schoolLoopsNumbersmath
No solutions yet
Easy

Disarium Number

Check whether a number equals the sum of its digits raised to their positions.

You'll learn Digit positionsInteger powers
BeginnerCS1High schoolLoopsNumbersmath
No solutions yet
Easy

Spy Number

Check whether the sum of a number's digits equals the product of its digits.

You'll learn Digit sumDigit product
BeginnerCS1High schoolLoopsNumbersmath
No solutions yet
Easy

Neon Number

Check whether the digit sum of a number's square equals the number.

You'll learn Digit sumSquaring
BeginnerCS1High schoolLoopsNumbersmath
No solutions yet