Prove that for all prime numbers p > 3, (p^{2} – 1) is a multiple of 24.

# Number Theory

Math puzzles and brain teasers involving the properties of integers

The digital sum of a number is just the sum of the individual digits. E.g., the digital sum of 123 is 1 + 2 + 3 = 6.

- The digital sum of
*x*is 42 - The digital sum of
*y*is 67 - When
*x*and*y*are added, you have to “carry the 1” exactly five times (e.g., if you add 8 and 9, you “carry the 1” once to get a “1” in the tens digit, thereby getting 17)

What is the digital sum of *z* = *x* + *y*?

This puzzle was coined the “Impossible Puzzle” by Martin Gardner, a famous math and science writer that liked to create and write about math games and puzzles. The puzzle is named as such because it *appears* to provide insufficient information to solve, but it is in fact solvable! Read on for the puzzle and the (very difficult) solution.

There are two distinct whole numbers greater than 1, we can call them *x* and *y* (where *y* > *x*). We know the sum of *x* and *y* is no more than 100.

Sam and Prada are perfect logicians. Sam (“sum”) is told *x* + *y* and Prada (“product”) is told *x* * *y*, and both of them know all the information provided so far.

Sam and Prada have this conversation in which they truthfully deduce the numbers:

- Sam: I know Prada does not know
*x*and*y*. - Prada: Well now I know
*x*and*y*. - Sam: Ah, now I also know
*x*and*y*.

Can you figure out *x* and *y* using this information?

I like the numbers 4 and 5. I like to add 4’s and 5’s together to make other numbers, such as 4 + 4 + 5 + 5 + 5 = 23. How many numbers from 1 to 1000 can be written as the sum of 4’s and 5’s?

In some cultures, it is typical for guests at an event to shake hands when they meet other guests (when there isn’t a pandemic). Some might be more social and shake hands with a lot of other guests, while others may be less social and shake hands with few or no other guests.

Can you prove that, regardless of the number of guests at the event, there must be at least two guests with the same number of handshakes at the event? In other words, can you prove that it is impossible for every guest to have shaken a different number of hands?

Assume guests can’t shake hands with themselves.

## Trailing Zeros

How many trailing zeros does 1000! have?

“!” is the factorial symbol. For example, 12! = 12 x 11 x 10 x … x 2 x 1 = 479001600, which has 2 trailing zeros (zeros at the end of the number).

A polydivisible number is a number for which the first *n* digits form a number evenly divisible by *n* for all *n* between 1 and the number of digits of that number.

In other words, the first 2 digits form a number divisible by 2, first 3 digits form a number divisible by 3, first 4 digits form a number divisible by 4, etc. for all of the digits of the number.

Can you arrange the digits 1-9 to form a 9-digit polydivisible number? Each digit 1-9 must be used exactly once.

## Larger Root

Without using a calculator of any kind, figure out which is the larger root:

- Square root of 2
- Cube root of 3

## Sum of Squares

If x is an even integer that can be written as the sum of two perfect squares, prove that x / 2 can also be written as the sum of two perfect squares.

You are trying to hit a moving battleship, but you have no way of monitoring its position. However, you have the following information:

- You know where the battleship started.
- You know when the battleship started moving.
- You know the battleship is only moving along a straight line.
- You know the battleship moves a constant speed per hour, and that speed is an integer. But you do not know what that speed is.

Every hour, you can fire precisely once at any point on that line. Is there a strategy you can use that will guarantee you will hit the battleship in a finite amount of time?

Fun fact, this was an actual brainteaser given to me in the second round interview for a hedge fund internship back in 2011.

Preparing for a brain teaser interview? Check out our ultimate guide to brain teaser interviews.

## Four Digits Squared

Which perfect square of a 4-digit number has the same last four digits as the original number?

## Arrange the Digits

There are 362,880 different ways to arrange the digits 1 through 9 into a 9-digit number. How many of these combinations are prime numbers?

A bicycle shop has some unique bicycles. Each bike is identical, and each bike’s front and back wheels has at least one spoke each. You don’t know how many bicycles are in the shop, but you know there are between 200 and 300 spokes in total.

If you knew the exact number of spokes, you would be able to figure out the number of bicycles.

You don’t know the exact number of spokes, but just knowing the fact that you would be able to figure it out with that information allows you to deduce the answer. How many bicycles and spokes are there?

## Divisible by 100

Prove that for any set of one hundred whole numbers, either one of those numbers is divisible by 100 or the sum of a subset of those numbers is divisible by 100.

Which two-digit numbers are exactly equal to seven times the sum of its digits?

## Flipping Every N-th

There are 100 face-down cards. The first person that passes by flips over every card, the 2nd person that passes by flips over every 2nd card, and so forth – the n-th person that passes by flips over every n-th card. Before you know it, 100 people have passed by.

After all 100 people have passed by, which cards are face-up and which are face-down?

Fun fact, this was an actual brainteaser given to me in the first round interview for a hedge fund internship back in 2011.

Preparing for a brain teaser interview? Check out our ultimate guide to brain teaser interviews.