IQ / Programming Quiz (Cannon-Ball Stacks)
-
Background
I'm reading "The Mammoth Book of IQ Puzzles". It contains, as you may have guessed, a bunch of IQ puzzles. I just solved one of them and thought I'd write the problem down here so you would all have a chance to solve it too. It is called "Cannon-Ball Stacks". In finding the answer, reference materials, books, calculators, and computers are allowed. Since computers are allowed, programs can be created to get the solution.
Cannon-Ball Stacks
A park ranger has stacked cannon-balls in two tetrahedral pyramids for display at Gettysburg. He later decides to combine the cannon-balls in both of the pyramids in order to create one large pyramid. The smallest number of cannon-balls he can have if the two pyramids are the same size is twenty (assuming he uses every cannon-ball in both pyramids).
[10 cannon-ball pyramid] + [10 cannon-ball pyramid] = [20 cannon-ball pyramid]
If the two smaller pyramids are different sizes, however, what would be the minimum number of cannon-balls he could use to make one large tetrahedral pyramid? Difficulty: 4 out of 5.
AspDotNetDev's Extra Rules
Explain how you arrived at the solution. If you create a program to help you solve the problem, paste that in your message. I will reply to this message with the answer in a hidden <span> tag. Don't cheat by looking first though! I will post tomorrow how I arrived at my solution (which may be incorrect, as the book doesn't list what the correct answer is). Points will be awarded for: elegance, quickness, humor, and correcting others (in no particular order). Good luck!
Answer: [680 (because 120 + 560 equals 680)]
-
Background
I'm reading "The Mammoth Book of IQ Puzzles". It contains, as you may have guessed, a bunch of IQ puzzles. I just solved one of them and thought I'd write the problem down here so you would all have a chance to solve it too. It is called "Cannon-Ball Stacks". In finding the answer, reference materials, books, calculators, and computers are allowed. Since computers are allowed, programs can be created to get the solution.
Cannon-Ball Stacks
A park ranger has stacked cannon-balls in two tetrahedral pyramids for display at Gettysburg. He later decides to combine the cannon-balls in both of the pyramids in order to create one large pyramid. The smallest number of cannon-balls he can have if the two pyramids are the same size is twenty (assuming he uses every cannon-ball in both pyramids).
[10 cannon-ball pyramid] + [10 cannon-ball pyramid] = [20 cannon-ball pyramid]
If the two smaller pyramids are different sizes, however, what would be the minimum number of cannon-balls he could use to make one large tetrahedral pyramid? Difficulty: 4 out of 5.
AspDotNetDev's Extra Rules
Explain how you arrived at the solution. If you create a program to help you solve the problem, paste that in your message. I will reply to this message with the answer in a hidden <span> tag. Don't cheat by looking first though! I will post tomorrow how I arrived at my solution (which may be incorrect, as the book doesn't list what the correct answer is). Points will be awarded for: elegance, quickness, humor, and correcting others (in no particular order). Good luck!
AspDotNetDev wrote:
what would be the minimum number of cannon-balls he could use to make one large tetrahedral pyramid?
A couple of points: - You can't make a tetrahedron with 10 cannon balls; you need 11. - You'd have to define "large".
I wanna be a eunuchs developer! Pass me a bread knife!
-
AspDotNetDev wrote:
what would be the minimum number of cannon-balls he could use to make one large tetrahedral pyramid?
A couple of points: - You can't make a tetrahedron with 10 cannon balls; you need 11. - You'd have to define "large".
I wanna be a eunuchs developer! Pass me a bread knife!
Mark Wallace wrote:
You can't make a tetrahedron with 10 cannon balls; you need 11.
Since you don't have a picture like I do, I'll give you a hint: 1 + 3 + 6 = 10.
-
Mark Wallace wrote:
You can't make a tetrahedron with 10 cannon balls; you need 11.
Since you don't have a picture like I do, I'll give you a hint: 1 + 3 + 6 = 10.
Since you have corrected Mark, I am awarding you "correcting others" points. Good job, me!
-
Mark Wallace wrote:
You can't make a tetrahedron with 10 cannon balls; you need 11.
Since you don't have a picture like I do, I'll give you a hint: 1 + 3 + 6 = 10.
-
Background
I'm reading "The Mammoth Book of IQ Puzzles". It contains, as you may have guessed, a bunch of IQ puzzles. I just solved one of them and thought I'd write the problem down here so you would all have a chance to solve it too. It is called "Cannon-Ball Stacks". In finding the answer, reference materials, books, calculators, and computers are allowed. Since computers are allowed, programs can be created to get the solution.
Cannon-Ball Stacks
A park ranger has stacked cannon-balls in two tetrahedral pyramids for display at Gettysburg. He later decides to combine the cannon-balls in both of the pyramids in order to create one large pyramid. The smallest number of cannon-balls he can have if the two pyramids are the same size is twenty (assuming he uses every cannon-ball in both pyramids).
[10 cannon-ball pyramid] + [10 cannon-ball pyramid] = [20 cannon-ball pyramid]
If the two smaller pyramids are different sizes, however, what would be the minimum number of cannon-balls he could use to make one large tetrahedral pyramid? Difficulty: 4 out of 5.
AspDotNetDev's Extra Rules
Explain how you arrived at the solution. If you create a program to help you solve the problem, paste that in your message. I will reply to this message with the answer in a hidden <span> tag. Don't cheat by looking first though! I will post tomorrow how I arrived at my solution (which may be incorrect, as the book doesn't list what the correct answer is). Points will be awarded for: elegance, quickness, humor, and correcting others (in no particular order). Good luck!
10 ball give a tetrahedron of 3 levels (1 on top, 3 below, 6 below) 20 ball give a tetrahedron if 4 levels (1 on top, 3 below, 6 below, 10 below) just look at tetrahedron of increasing sizes and forecast what was going to happen... [EDIT] each level number of balls = N + previous level (i.e. level N has N(N+1)/2 balls) then you can easily write the table (1, 3, 6, 10, 15, 21, etc...) and play with the numbers...
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.
-
I didn't even have a category for that, but you get points for helping with visuals :)
-
10 ball give a tetrahedron of 3 levels (1 on top, 3 below, 6 below) 20 ball give a tetrahedron if 4 levels (1 on top, 3 below, 6 below, 10 below) just look at tetrahedron of increasing sizes and forecast what was going to happen... [EDIT] each level number of balls = N + previous level (i.e. level N has N(N+1)/2 balls) then you can easily write the table (1, 3, 6, 10, 15, 21, etc...) and play with the numbers...
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.
That is the idea. Easy enough, right? So you should be able to do it, right? Right!? :)
-
That is the idea. Easy enough, right? So you should be able to do it, right? Right!? :)
Well, didn't I? I think than maybe I didn't understand the question, let me read it again...
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.
-
Well, didn't I? I think than maybe I didn't understand the question, let me read it again...
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.
There is a single numeric answer.
-
Mark Wallace wrote:
You can't make a tetrahedron with 10 cannon balls; you need 11.
Since you don't have a picture like I do, I'll give you a hint: 1 + 3 + 6 = 10.
I just made one with mints, and I had to put one in the middle on the third layer. Mind you, the mints are all different sizes and shapes -- but if they were all the same, it would have drained the fun out of it.
I wanna be a eunuchs developer! Pass me a bread knife!
-
Background
I'm reading "The Mammoth Book of IQ Puzzles". It contains, as you may have guessed, a bunch of IQ puzzles. I just solved one of them and thought I'd write the problem down here so you would all have a chance to solve it too. It is called "Cannon-Ball Stacks". In finding the answer, reference materials, books, calculators, and computers are allowed. Since computers are allowed, programs can be created to get the solution.
Cannon-Ball Stacks
A park ranger has stacked cannon-balls in two tetrahedral pyramids for display at Gettysburg. He later decides to combine the cannon-balls in both of the pyramids in order to create one large pyramid. The smallest number of cannon-balls he can have if the two pyramids are the same size is twenty (assuming he uses every cannon-ball in both pyramids).
[10 cannon-ball pyramid] + [10 cannon-ball pyramid] = [20 cannon-ball pyramid]
If the two smaller pyramids are different sizes, however, what would be the minimum number of cannon-balls he could use to make one large tetrahedral pyramid? Difficulty: 4 out of 5.
AspDotNetDev's Extra Rules
Explain how you arrived at the solution. If you create a program to help you solve the problem, paste that in your message. I will reply to this message with the answer in a hidden <span> tag. Don't cheat by looking first though! I will post tomorrow how I arrived at my solution (which may be incorrect, as the book doesn't list what the correct answer is). Points will be awarded for: elegance, quickness, humor, and correcting others (in no particular order). Good luck!
My shot at the answer - quick and not optimized, I'm sure :)
class Program { const int RANGE = 1000; static void Main( string\[\] args ) { int sum, p1, p2; for( int a = 0; a < RANGE; a++ ) { p1 = ( a \* ( a + 1 ) \* ( a + 2 ) ) / 6; for( int b = a + 1; b < RANGE; b++ ) { p2 = ( b \* ( b + 1 ) \* ( b + 2 ) ) / 6; for( int i = b + 1; i < RANGE; i++ ) { sum = ( i \* ( i + 1 ) \* ( i + 2 ) ) / 6; if( sum == p1 + p2 ) { Console.WriteLine( sum.ToString() + "=" + p1.ToString() + "+" + p2.ToString() + "\\n" ); } } } } Console.ReadKey(); } }
SPOILER ALERT!! The answer I got is: 680 = 120 + 560 EDIT: I am aware I could have just stopped looking after the first hit - but I was also curious if there would be a lot of results :)
-
Background
I'm reading "The Mammoth Book of IQ Puzzles". It contains, as you may have guessed, a bunch of IQ puzzles. I just solved one of them and thought I'd write the problem down here so you would all have a chance to solve it too. It is called "Cannon-Ball Stacks". In finding the answer, reference materials, books, calculators, and computers are allowed. Since computers are allowed, programs can be created to get the solution.
Cannon-Ball Stacks
A park ranger has stacked cannon-balls in two tetrahedral pyramids for display at Gettysburg. He later decides to combine the cannon-balls in both of the pyramids in order to create one large pyramid. The smallest number of cannon-balls he can have if the two pyramids are the same size is twenty (assuming he uses every cannon-ball in both pyramids).
[10 cannon-ball pyramid] + [10 cannon-ball pyramid] = [20 cannon-ball pyramid]
If the two smaller pyramids are different sizes, however, what would be the minimum number of cannon-balls he could use to make one large tetrahedral pyramid? Difficulty: 4 out of 5.
AspDotNetDev's Extra Rules
Explain how you arrived at the solution. If you create a program to help you solve the problem, paste that in your message. I will reply to this message with the answer in a hidden <span> tag. Don't cheat by looking first though! I will post tomorrow how I arrived at my solution (which may be incorrect, as the book doesn't list what the correct answer is). Points will be awarded for: elegance, quickness, humor, and correcting others (in no particular order). Good luck!
The number of balls for each level of the pyramid increases like: 1, 3, 6, 10, 15, 21, 28. This means that the number of balls for each larger pyramid is as follows: 4, 10, 20, 35, 56, 84. So we are looking for a pyramid size that can be created with the sizes of the two pyramids that go before it. 84 is the first number for which this is possible, being combined from the pyramids with 35 and 56 balls.
0100000101101110011001000111001011101001
-
The number of balls for each level of the pyramid increases like: 1, 3, 6, 10, 15, 21, 28. This means that the number of balls for each larger pyramid is as follows: 4, 10, 20, 35, 56, 84. So we are looking for a pyramid size that can be created with the sizes of the two pyramids that go before it. 84 is the first number for which this is possible, being combined from the pyramids with 35 and 56 balls.
0100000101101110011001000111001011101001
-
My shot at the answer - quick and not optimized, I'm sure :)
class Program { const int RANGE = 1000; static void Main( string\[\] args ) { int sum, p1, p2; for( int a = 0; a < RANGE; a++ ) { p1 = ( a \* ( a + 1 ) \* ( a + 2 ) ) / 6; for( int b = a + 1; b < RANGE; b++ ) { p2 = ( b \* ( b + 1 ) \* ( b + 2 ) ) / 6; for( int i = b + 1; i < RANGE; i++ ) { sum = ( i \* ( i + 1 ) \* ( i + 2 ) ) / 6; if( sum == p1 + p2 ) { Console.WriteLine( sum.ToString() + "=" + p1.ToString() + "+" + p2.ToString() + "\\n" ); } } } } Console.ReadKey(); } }
SPOILER ALERT!! The answer I got is: 680 = 120 + 560 EDIT: I am aware I could have just stopped looking after the first hit - but I was also curious if there would be a lot of results :)
Points awarded for: correctness, elegance, quickness, and mathematical insight. It seems you found an equation for the number of elements in a pyramid for the Nth pyramid. Nice! Since you already have a better program than mine, I might as well share mine now instead of waiting until tomorrow:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
for (var i = 1; i <= 30; i++)
{
txtOut.AppendText(Environment.NewLine + CalculateNumBalls(i).ToString());
}
}public int CalculateNumBalls(int index) { if (index <= 1) { return index; } else { return CalculateNumBalls(index - 1) + CalculateLayer(index); } } public int CalculateLayer(int index) { int total = 0; for (var i = 1; i <= index; i++) { total += i; } return total; }
}
That just displays the number of balls in the Nth pyramid for the first thirty pyramids. I just used a calculator to see what the difference was between each number. I saved time because I didn't have to calculate all the way down (given largePyramid - mediumPyramid = smallPyramid, I could just stop when smallPyramid was larger than mediumPyramid). Out of curiosity, did you know that formula already, or did you figure it out?
-
I just made one with mints, and I had to put one in the middle on the third layer. Mind you, the mints are all different sizes and shapes -- but if they were all the same, it would have drained the fun out of it.
I wanna be a eunuchs developer! Pass me a bread knife!
Virtual balls. Also, pool may help. :)
-
Virtual balls. Also, pool may help. :)
Oh, I know the Maths, but I don't come to the Lounge for work. It's much more fun ignoring thousands of years' learning on triangular numbers, etc, and building pyramids out of mints. I've already done my serious posting of the day. It's a bit much to expect another one.
I wanna be a eunuchs developer! Pass me a bread knife!
-
Well, didn't I? I think than maybe I didn't understand the question, let me read it again...
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.
You keep deleting your messages before I can reply to them, so here is what I was going to say in response to one of them... :)
There is no pyramid composed of exactly 91 balls. It goes 84, then 120. You are on the right track though. Let me phrase it another way. There are 3 pyramids: A, B, and C. A is the smallest, B is larger, and C is the largest. The number of balls in C is equal to the sum of the balls in A and B. A does not equal B. This is the question: Find the smallest possible value of C.
-
Oh, I know the Maths, but I don't come to the Lounge for work. It's much more fun ignoring thousands of years' learning on triangular numbers, etc, and building pyramids out of mints. I've already done my serious posting of the day. It's a bit much to expect another one.
I wanna be a eunuchs developer! Pass me a bread knife!
If they are thin mints, I fear you may never succeed, as the rate of consumption will outpace the rate of production.
-
10 ball give a tetrahedron of 3 levels (1 on top, 3 below, 6 below) 20 ball give a tetrahedron if 4 levels (1 on top, 3 below, 6 below, 10 below) just look at tetrahedron of increasing sizes and forecast what was going to happen... [EDIT] each level number of balls = N + previous level (i.e. level N has N(N+1)/2 balls) then you can easily write the table (1, 3, 6, 10, 15, 21, etc...) and play with the numbers...
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station.... _________________________________________________________ My programs never have bugs, they just develop random features.
Super Lloyd wrote:
level N has N(N+1)/2 balls
Points for realizing this. I too realized this, but couldn't remember the exact function. :thumbsup: