23

A group of Seven men robbed a diamond shop at night. They ran to a nearby forest and all slept there for the night.

  1. One of them woke up and tried to run away with the bag full of diamonds, but another one woke up at the same time and caught him.
  2. They both decided to divide the diamonds in half and run away, but when they divided them, they got one diamond as a remainder.
  3. So they woke up the third man. They again divided the diamonds and got one as a remainder.
  4. They woke up the fourth, fifth, and sixth men one by one, each time dividing the diamonds equally and getting exactly one diamond as a remainder.
  5. But when they woke up the last man, all the diamonds were divided equally and completely.

Since there are multiple solution for this, how many lowest possible number [greater than 0] of diamonds were there?

Wasiq Shahrukh
  • 1,046
  • 12
  • 24

10 Answers10

71

Let's say $N$ is the number of diamonds:
After the first 6 woke up we can deduce:

$N \mod 2 = N \mod 3 = ... = N \mod 6 = 1$

This means that

$N - 1$ is a multiple of the smallest common multiple of $2,3,4,5,6$.
So $N - 1$ is a multiple of 60.

After the 7th wakes up we deduce...

$N$ is a multiple of 7.

So

we need the smallest number $N$ a multiple of 7 and $N-1$ a multiple of 60.

Starting at 1...wrong because it's not a multiple of 7.
61... wrong
121...Neh
181...Nope again
241...keep looking
301...Winner.

Marius
  • 18,049
  • 4
  • 54
  • 101
15

There are

301 Diamonds

because:

The least common multiple of 2, 3, 4, 5, 6 is 60.
So the number can be 60X+1,
We can apply from 1 to X.
x=1-> 61 ----> Wrong
x=2-> 121----> Wrong
x=3-> 181----> Wrong
x=4-> 241----> Wrong
x=5-> 301 --- Thats it!

301 %2=1
301 %3=1
301 %4=1
301 %5=1
301 %6=1
301 %7=0

Kayathiri
  • 452
  • 4
  • 9
8

There are this many diamonds:

301

Explanation in Java:

     Boolean posnumber = false;
     int i = 1;
     int x = 7;
     while (!posnumber) {
     System.out.println(i + ". " + x);
     if (x % 2 == 1
      && x % 3 == 1
      && x % 4 == 1
      && x % 5 == 1
      && x % 6 == 1
      && x % 7 == 0) {

            posnumber = true;

     }
     i++;
     x = x+7;
 }

Output:
1. 7
2. 14
3. 21
4. 28
(...)
41. 287
42. 294
43. 301

Fabich
  • 7,165
  • 2
  • 35
  • 59
Steezar
  • 89
  • 2
  • 1
    you don't need code to solve this. – Marius Jun 09 '16 at 11:47
  • 3
    No, but points for creativity. – Rebecca Whitlock Jun 09 '16 at 11:51
  • 4
    @Marius ...yeah sure..but the Ide was open, i searched for a problem on Stackoverflow and saw this on the right under Hot Questions...well used 2 minutes to get my mind free :) – Steezar Jun 09 '16 at 12:47
  • You don't need code to figure anything out theoretically. But it's cooler and at least for me, it would be the easiest way to find it correctly the first time, with minimal use of my ever lacking math talents. – discodane Jun 10 '16 at 15:23
  • 2
    There is a much more concise Java answer: int i = 7; while ((i % 4 != 1) || (i % 5 != 1) || (i % 6 != 1)) { i += 7; } System.out.println(i); –  Jun 10 '16 at 19:04
7

This type of problems is exactly what the Chinese Remainder Theorem is for.

It's used to solve systems of modular equations.

$x = 1\ mod\ 2$

$x = 1\ mod\ 3$

$...$

Where each equation $x = r\ mod\ n$ means that the remainder of $x$ divided by $n$ is $r$.

Here is an online calculator to solve it automatically.

The answer is 301.

devil0150
  • 179
  • 3
  • I think you should make the answer part more important in your answer... – AJL Jun 09 '16 at 20:24
  • What do you mean? I should remove the parenthesis? – devil0150 Jun 09 '16 at 20:27
  • I feel like answers are usually in a spoiler tag. That draws attention to it, usually. The explanation isn't necessarily so. – AJL Jun 10 '16 at 14:30
  • Note x is unique modulus N = lcm(2, ..., 7) = 420. So 301 is indeed the lowest possible positive solution. – Oriol Jun 10 '16 at 19:43
3

There are this many diamonds:

2401

Explanation:

$2401\mod2 = 1$
$2401\mod3 = 1$
$2401\mod4 = 1$
$2401\mod5 = 1$
$2401\mod6 = 1$
$2401\mod7 = 0$

feelinferrety
  • 5,297
  • 18
  • 40
3

From the 1 left over, we have

$$N \equiv 1 \mod \mathbb{K}$$

for $\mathbb{K}$ from 2 to 6. This is equivalent to

$$N \equiv 1 \mod lcm(2,3,4,5,6)$$

or

$$N \equiv 1 \mod 60$$

or there exists a $k$ such that $60k = N-1$.

Next, we have $N \equiv 0 \mod 7$, or there exists a $u$ such that $7u = N$.

Combining equations we get $60k+1 = 7u$, or $60k \equiv -1 \mod 7$.

Now $60 \equiv 4 \mod 7$, so we get $4k \equiv -1 \mod 7$ or $k \equiv 5 \mod 7$, aka $k = 5 + 7t$.

We are then restricted by the number of diamonds being non-negative and $t$ being an integer, or $(5+7t)60+1 \geq 0$, or $7t \geq -5-1/60$, or $t \geq 0$.

Letting $t = 0$ we get $k=5$ and hence $u=43$, or 301 diamonds.

This algorithm can be followed mindlessly to generate the least number of diamonds. For example, imagine if they where short 1 each time (instead of 1 extra). Then we'd end with $4k \equiv 1 \mod 7$, or $k \equiv 2 \mod 7$ or $k = 2 +7t$ for some integer $t$. The result that $t \geq 0$ still occurs, and hence we get 119 diamonds.

Yakk
  • 172
  • 6
2

Number of diamonds are:

There are 301 diamonds.

Explanation:

7y must end with 1. (since 7y-1 should be divisible by 5 and 2 at the same time; i.e, 7y-1 should be divisible by 10, or 7y must end with 1 ) hence y should end with 3 (no other digit can make 7y end with 3) 7y should be greater than 61.

Trial and Error:

7(3)<61
7(13)= 91; 90 not divisible by 60
7(23)=161; 160 not divisible by 60
7(33)=231; 230 not divisible by 60
7(43)=301; 300 divisible by 60

White Shadow
  • 129
  • 3
1

301

Here's how to solve it in Ruby:

(0..1000).each do |diamonds|
puts "#{diamonds}" if
diamonds % 2 == 1 and
diamonds % 3 == 1 and
diamonds % 4 == 1 and
diamonds % 5 == 1 and
diamonds % 6 == 1 and
diamonds % 7 == 0
end

Mike Earnest
  • 32,336
  • 6
  • 92
  • 237
-1

91

2*3*5=30
(28+2)*x+1 = N/7
(28+2)*3+1= 28*3+(6+1)=91

That's it.

Marius
  • 18,049
  • 4
  • 54
  • 101
-3

n+1 ,2n+1 ,3n+1---diamonds when we share these diamonds for N members evertime 1 diamond is left so lowest number is n+1

JMP
  • 35,612
  • 7
  • 78
  • 151