Numbers and Math for Beginners

FizzBuzz, primes, Fibonacci, GCD and digit tricks: the number puzzles that build problem-solving confidence.

  1. FizzBuzz The classic: count from 1 to n, replacing multiples of 3 with Fizz, of 5 with Buzz, and of both with FizzBuzz. Easy All 5 languages
  2. Factorial Compute n! = 1 × 2 × ... × n. Easy All 5 languages
  3. Fibonacci Number Return the nth Fibonacci number, where each number is the sum of the two before it. Easy All 5 languages
  4. Is It Prime? Check whether a number is prime by testing divisors up to its square root. Easy All 5 languages
  5. Greatest Common Divisor Find the largest number that divides two numbers, with Euclid's algorithm. Easy All 5 languages
  6. Sum of Digits Add up the digits of a non-negative integer. Easy All 5 languages
  7. Power of Two Check whether a number is a power of two (1, 2, 4, 8, ...). Easy All 5 languages
  8. Count Primes Below n Count the prime numbers less than n using the Sieve of Eratosthenes. Medium All 5 languages
  9. Leap Year Decide whether a year is a leap year in the Gregorian calendar. Easy All 5 languages
  10. Reverse an Integer Reverse the digits of an integer, keeping its sign. Easy All 5 languages
  11. Armstrong Number Check whether a number equals the sum of its digits each raised to the number of digits. Easy All 5 languages

← All coding problems

Was this page helpful?