PDA

View Full Version : Fun counting math puzzle



Necronopticous
01-04-2006, 05:05 AM
I just did this little math puzzle for an assignment in my discreet structures class and I thought I'd share it with you guys, let's see who can get the correct answer first.

The story goes like this: There are five pirates partying over a chest of diamonds they've just plundered which they're planning on splitting up in the morning before they go their separate ways. During the night one of the pirates wakes up and decides to go ahead and take his share so he can set sail early, so he splits the diamonds equally into five piles. At the end of the five piles he ends up with one extra diamond, so he thinks about it for awhile and decides to throw it in the ocean, take his pile, pool the rest of the diamonds back into the chest, and take off with his share.

A few minutes later, another pirate wakes up and does the exact same thing, not noticing that the first pirate had already taken his share, thus making five piles again. At the end, he too ends up with one extra diamond and decides to toss it into the ocean. After taking one of the piles and pooling the rest back into the chest, he sets sail as well.

This goes on one by one until all five pirates have eventually left, never noticing that the others left before them, and each time there is one extra diamond.

The question is: what is the least possible number of diamonds that could have possibly originally been in the chest? GOOD LUCK

eestlinc
01-04-2006, 05:18 AM
oh, that's a nice puzzle.

Hawkeye
01-04-2006, 05:26 AM
Can these diamonds be broken into halves, or is the answer a whole number?

Necronopticous
01-04-2006, 05:27 AM
The answer is a whole number, assume the diamonds are all exactly the same size and value.

Kirobaito
01-04-2006, 05:31 AM
I'm assuming that the final pirate doesn't throw a diamond into the ocean.

Necronopticous
01-04-2006, 05:32 AM
YES THE FINAL PIRATE THROWS A DIAMOND!

Kirobaito
01-04-2006, 05:33 AM
YES THE FINAL PIRATE THROWS A DIAMOND!
What an idiot.

krissy
01-04-2006, 05:35 AM
he didn't know his friends left
honor amongst thieves!

Necronopticous
01-04-2006, 05:40 AM
The thing is that they all make five piles, and they all throw one extra diamond away because they don't realize the others already did the same thing.

Anyway, this is a math puzzle, it only follows that the characters involved would be completely stupid and not in any kind of sound mind.

Shlup
01-04-2006, 05:43 AM
This is stupid. I hate you, Jeremy.

Kirobaito
01-04-2006, 05:50 AM
I can't believe I worked for an entire page to try and figure this out. I couldn't even get past the second to last pirate.

eestlinc
01-04-2006, 05:54 AM
I got up to four pirates when I ran into a number not divisible by four.

krissy
01-04-2006, 05:59 AM
i'm still at 3

:choc:

Xaven
01-04-2006, 06:11 AM
AHAHAH!!! YAY! :kaolove2:

Yeah, I figured it out. It took a while to get the graph going and write so small but I pulled through.

They started with 3,121 diamonds?

Raistlin
01-04-2006, 06:24 AM
AHAHAH!!! YAY! :kaolove2:

Yeah, I figured it out. It took a while to get the graph going and write so small but I pulled through.

They started with 3,121 diamonds?
Thank god I stopped trying to figure it out by hand.

Del Murder
01-04-2006, 06:40 AM
I should have never opened this thread. Damn you Necro! This thing is going to plague me now.

Raven Nox
01-04-2006, 06:41 AM
I'm not even gonna try it. It's a nice puzzle though, I just don't like doing math.

krissy
01-04-2006, 06:45 AM
man Xaven
did you derive or did you graph the original, because deriving this would have a chain of like 1543443264326

:cry:

brb slitting writsts

eestlinc
01-04-2006, 06:45 AM
OMG! Xaven is right. I had it when I said I had up to four pirates and just didn't realize it. I just got to 2496 and said, "oh, that doesn't work because 2496/4 = 624 and I need a number that ends in 9" forgetting that all I had to do was multiply 624 by 5 then add one to get the answer rather than continuing on another step. I just worked it out by trial and error, recognizing some patterns so I really only had to try about 15 sets of numbers.

Xaven
01-04-2006, 06:48 AM
Anyone want my work?

Del Murder
01-04-2006, 06:50 AM
Yes!

eestlinc
01-04-2006, 06:52 AM
I made a grid like so:

3121 | 624
2496 | 499
1996 | 399
1596 | 319
1276 | 255


of course I got to top right and said "oh, this won't work" even though I was one step from the answer, because I am dumb.

Raistlin
01-04-2006, 06:52 AM
And Del pats himself on the back for others' accomplishments.

Is that how it works in Staff, too? :p

Xaven
01-04-2006, 06:52 AM
Whoops. Just deleted my post. Del, can you put it back?

I'll add the pictures in a sec...

eestlinc
01-04-2006, 06:54 AM
and I do Del's work for him!

Del Murder
01-04-2006, 06:55 AM
And Del pats himself on the back for others' accomplishments.

Is that how it works in Staff, too? :p
Way to make me look bad Xaven.

But yes.

Raistlin
01-04-2006, 06:57 AM
ahahahahahahahahahahaha

xDDDD

That deleted post was brilliantly timed.

Necronopticous
01-04-2006, 07:01 AM
Good job, Xaven. You shall now forever be known in my heart as a good man.

Xaven
01-04-2006, 07:02 AM
And here they are, big as ever.
http://i13.photobucket.com/albums/a260/Vinylcake/Workkk2.jpg
Tada? Yeah, not too impressive.

The other picture is of the other side of the paper which I did first. I didn't quite know what I was doing at the time hence the unposted scribbles.

eestlinc
01-04-2006, 07:02 AM
so is there a more direct way to solve this other than trial and error? Some solution involving modular arithmetic?

Xaven
01-04-2006, 07:08 AM
so is there a more direct way to solve this other than trial and error? Some solution involving modular arithmetic?
Whatever that means.

I just looked for patterns. Like how all the first steps increase by 20, and the seconds by 25. The fifth one is the one we needed so just use the almighty magic formula to work your way up the ladder 3 times (twice to find the difference and thrice to check). Find the difference 'tween the numbers playing the same role (48.828125 for the fifth ones). Then go 93.65625 (the smallest fifth step) + 48.828125 and spam your equals key 'till a whole number pops up. The End.

Edit: If your confused, reread as I added some missing words.

Del Murder
01-04-2006, 07:09 AM
Yeah, that's what I want to know.

edczxcvbnm
01-04-2006, 07:10 AM
I don't know how well this would work but wouldn't you just do a x y problem? ((((((((((X-1)/5)-1)/5)-1)/5)-1)/5)-1)/5)=y

I have no clue if it would work as I just pulled it out of my ass but it kind of looks right :erm:

EDIT: Upon looking at what I typed it is bizull/xxx.gif/xxx.gif/xxx.gif/xxx.gifz.

krissy
01-04-2006, 07:12 AM
^ that is what i've been trying but i think i screwed up the equation :{


(x-1)*5/4 - 1/5 - ((x-1)*5/4 -1/5)*5/4 -1/5 - (((x-1)*5/4 -1/5)*5/4 -1/5)*5/4 -1/5 - ((((x-1)*5/4 -1/5)*5/4 -1/5)*5/4 -1/5)*5/4 -1/5 - (((((x-1)*5/4 -1/5)*5/4 -1/5)*5/4 -1/5)*5/4 -1/5)*5/4 -1/5

eestlinc
01-04-2006, 07:12 AM
I tried that, ed, but it seemed like more work than just plugging in values.

edczxcvbnm
01-04-2006, 07:14 AM
Plugging in numbers. You just type it into a calculator and tell it what x should be equal to and let it do the math for you.

Del Murder
01-04-2006, 07:16 AM
That's what I tried at first but I had trouble making whole numbers out of it. Anyway, bedtime.

Xaven
01-04-2006, 07:17 AM
Plugging in numbers. You just type it into a calculator and tell it what x should be equal to and let it do the math for you.
That works, but you won't get a whole number unless you start with 1,276. And I doubt there's anyway you would know to start there.

Raistlin
01-04-2006, 07:17 AM
But what is x equal to? :p

EDIT: in reply to ed

eestlinc
01-04-2006, 07:22 AM
I didn't have a calculator though.

krissy
01-04-2006, 07:32 AM
yeah ok that equation doesn't work
nor does the derivative

there is so much blood on my wrists right now

edczxcvbnm
01-04-2006, 07:33 AM
I have no clue what X is equal to. I am too lazy to go get the calculator and make educated guesses...or better yet just write the forumal into a math program that would go through the numbers until there is no remainder.

Necronopticous
01-04-2006, 08:36 AM
I wrote a sloppy PHP bruteforce program to solve it:

http://demented3d.com/nissen/upload/prog02.jpg

Here is it working, showing the answer:

http://demented3d.com/nissen/upload/try2.php

edczxcvbnm
01-04-2006, 03:50 PM
Sweet

Shoden
01-04-2006, 03:56 PM
After banging my head and getting tounge tied I came up with 3125

rubah
01-04-2006, 10:44 PM
I find it ironic that despite not paying attention to the problem I still came rather close to the answer, getting 3206.

Either I'm bad at pen and paper math, or this is just weird.

[edit- I'm just bad at multiplying, that's all. my real answer (wronger than before) is now 3906xD]

Del Murder
01-05-2006, 03:34 AM
The program makes it clear as day. That was in my head but it's hard to work out by hand without that nifty modulus function.

Lindy
01-05-2006, 03:38 AM
I'm sure by "fun" you mean "I'm going to rape your brain".

I never understood how people could enjoy maths, it must just be one of those things, like how some people enjoy hurting small woodland animals.

P.S. This topic is proof of why ninja are better, pirates are morons who throw away diamonds.

Miriel
01-05-2006, 03:42 AM
I'm sure by "fun" you mean "I'm going to rape your brain".

I never understood how people could enjoy maths, it must just be one of those things, like how some people enjoy hurting small woodland animals.

You speak the truth. :up:

edczxcvbnm
01-05-2006, 03:49 AM
It isn't math. It is the fun of solving a problem. I also like to harm small woodland animals...:D

Xaven
01-05-2006, 04:05 AM
I'm sure by "fun" you mean "I'm going to rape your brain".

I never understood how people could enjoy maths, it must just be one of those things, like how some people enjoy hurting small woodland animals.
But math is fun!

...I'm sad now. :kaocry:

Doomie
01-05-2006, 04:07 AM
I'm not quite sure what the problem is asking, nor am I sure how to get to that solution. Someone tone it down, kthx.

Xaven
01-05-2006, 04:18 AM
I'm not quite sure what the problem is asking, nor am I sure how to get to that solution. Someone tone it down, kthx.
They're asking 'How many diamonds did the pirates start out with?'.

5 pirates find some treasure (a bunch of diamonds). Oblivious to eachother, they each divide the pile into five and take their share, BUT there's always one diamond left over (eg, 31 diamonds divided by five equals 6, with a remainder of 1). They toss the extra diamond overboard. Okay, so after the first pirate takes his share and tosses the extra diamond, the second pirate does the same, not knowing that the Pirate 1 already took his share! (Pirates 2-5 all get screwed) This happens until all 5 pirates have taken one fifth of the pile away, each time with one left over.

As for solving it, there's their big, fancy, BORING way, and my UN-BORING way. Your choice.

Doomie
01-05-2006, 04:20 AM
I didn't understand both. but I was using a calculator which gave me decimals, which may be why I didn't understand it. Thanks a bunch. ;]

Dr Unne
01-05-2006, 05:11 AM
This is also sadly brute-forcish:


#!/usr/bin/ruby

def find_num(x, try, max)
# Output intermediary steps if you want
# puts "#{x},#{try},#{max}"
return false if x % 5 != 1
return true if try == max
return x if find_num( (x-1) * 4/5, try+1, max)
end

1.upto(99999999999) do |x|
if(ans = find_num(x, 1, 5))
puts "Answer: #{ans}"
break
end
end

Assuming this program works (and I have no idea if it does) you can figure out an arbitrary number of pirates greater than 1. The answer to 8 pirates is 390621. The answer to 9 pirates is 1953121. The answer to 10 pirates is 9765621. This program appears to take exponentially more time as you increase the number of pirates linearly, which means it's a sucky algorithm. 11 pirates would take many minutes to solve.

Treize
01-06-2006, 02:54 AM
sorry to tell u guys this but the least possble # is 1 because theres more then 1 dimoned(i cant spell good) in the chest to start with so thats the least possble # i think?

Del Murder
01-06-2006, 03:44 AM
So the other pirates divide up nothing?

Xaven
01-06-2006, 06:36 PM
sorry to tell u guys this but the least possble # is 1 because theres more then 1 dimoned(i cant spell good) in the chest to start with so thats the least possble # i think?
Nope.

It says they throw the extra diamond overboard. If there was 1 diamond and it was discarded by Pirate 1, then what would Pirates 2, 3, 4, 5 throw overboard? It says they all throw 1 extra diamond overboard.

Flying Mullet
01-06-2006, 06:59 PM
I ended up with 3906 too.

1*5 +1 = 6
6 * 5 + 1 = 31
31 * 5 + 1 = 156
156 * 5 + 1 = 781
781 * 5 + 1 = 3906

Dr Unne
01-06-2006, 07:09 PM
3906 is the answer to the problem where the pirate divides the diamonds into 5 piles, takes 4 of the piles and leaves 1 pile behind.

Flying Mullet
01-06-2006, 07:14 PM
Ahh, good catch.