It is unlikely that you ever used prime numbers in your day-to-day job. Same applies to Fibonacci sequences, factorial, etc. Like it or not, a lot of companies out there use math concepts on their coding questions. Of course, you can ask questions; most interviewers accept that you don’t remember math concepts from high school. However, knowing these will save you precious minutes and will make you feel much more confident. Here are some to watch out for:

Modulo (remainder operator)

Modulo is a straightforward concept, but you often see people struggling with it. The module operator is used to find the remainder after the division of two integers. Say you want to work out the integer division of 17 divided by 5. The result is 3, and the remainder is 2 (17-15). Simple concept but used heavily in coding interviews. The following exercises use the modulo operator:

Fizz Buzz
Sum Multiples of Three and Five
Package Rice Bags
Package Rice Bags (part 2)

Prime number

A prime number can only be divided by itself and one. Nine is not a prime number as it can be divided by three. Seven is a prime as it cannot be divided by any other integer other than seven itself and one. Prime numbers have all sorts of applications in software engineering, most notably in Cryptography. But let’s not get into that now; interviewers use whiteboard interview questions involving prime numbers, and you can practice there here:

Prime Number
Largest Prime Factor

Fibonacci sequence

The first two elements of the Fibonacci sequence are zero and one. Each subsequent number is the sum of the two previous numbers. Here are the ten first Fibonacci numbers.

0, 1, 1, 2, 3, 5, 8, 13, 21, 34

This code kata is an absolute classic. Get familiar with both recursive and non-recursive implementation fo this exercise:

This code kata is an absolute classic. A particular call out for the recursive version.
Fibonacci Number
Even Fibonacci Sum

Factorial

The factorial of a given number is the product of all positive integers that are equal to or less than that number. For instance, the factorial of five is:

5! = 5 x 4 x 3 x 2 x 1 = 120

Again, this coding interview question may come in two flavours (recursive and non-recursive). Try both here:
Factorial

Palindrome

A palindrome is an entity that reads the same backwards as forwards. It applies to strings, lists, arrays, etc. Examples of palindromes are “ABBA”, “Step on no pets” or [10,3,5,3,10].
Palindrome Check
Longest Palindrome in Word

Greatest Common Divisor

The Greatest Common Divisor of two positive integers is the largest integer that divides both without a remainder. The Greatest Common Divisor of 10 and 25 is 5.

Watch out for the recursive versions of this classic programming question: Greatest Common Divisor