Problem 222

A place to air possible concerns or difficulties in understanding ProjectEuler problems. This forum is not meant to publish solutions. This forum is NOT meant to discuss solution methods or giving hints how a problem can be solved.
Forum rules
As your posts will be visible to the general public you are requested to be thoughtful in not posting anything that might explicitly give away how to solve a particular problem.

This forum is NOT meant to discuss solution methods for a problem.

In particular don't post any code fragments or results.

Don't start begging others to give partial answers to problems

Don't ask for hints how to solve a problem

Don't start a new topic for a problem if there already exists one


See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
Post Reply
ozgur
Posts: 1
Joined: Thu Nov 13, 2008 3:57 pm

Problem 222

Post by ozgur »

My shortest pipe results in two intersecting spheres. One sphere (sn) in the middle intersects with the sphere two levels below it (sn-2). To account for that, I move sn along the pipe a little so that it does not intersect with sn-2. Am I on the right track, or should the correct solution result in no such intersections?
User avatar
ed_r
Posts: 1009
Joined: Sun Jul 29, 2007 10:57 am

Re: Problem 222

Post by ed_r »

No intersections.
!647 = &8FDF4C
axelbrz
Posts: 51
Joined: Mon Sep 08, 2008 5:34 am

Re: Problem 222

Post by axelbrz »

Hi, can anyone confirm me if the length in micrometers of the shortest pipe, of internal radius 50mm, that can fully contain 3 balls of radii 48mm, 49mm and 50mm, is 293949?

Thank you!
"think(O(n))+O(n) sometimes is better than think(O(1))+O(1)"

Image
User avatar
stijn263
Posts: 1505
Joined: Sat Sep 15, 2007 11:57 pm
Location: Netherlands

Re: Problem 222

Post by stijn263 »

Just putting the 3 balls on top of eachother you arrive at 294,000 micrometers. So 293,949 seems correct, but you should be able to verify this for yourself (by checking all 6 configurations)
axelbrz
Posts: 51
Joined: Mon Sep 08, 2008 5:34 am

Re: Problem 222

Post by axelbrz »

Yes, I did it! :) But I just wanted to know if I got the concept because my answer is wrong.

I'll check it.

Thanks!
"think(O(n))+O(n) sometimes is better than think(O(1))+O(1)"

Image
axelbrz
Posts: 51
Joined: Mon Sep 08, 2008 5:34 am

Re: Problem 222

Post by axelbrz »

Mmm.. I'm also getting a wrong answer...

Can anyone confirm me if the shortest length of the pipe in micrometers for balls with radii 28, 31, 34, 35, 36, 37, 40, 45, 49 and 50 mm is 648649?

Thanks!
"think(O(n))+O(n) sometimes is better than think(O(1))+O(1)"

Image
User avatar
daniel.is.fischer
Posts: 2400
Joined: Sun Sep 02, 2007 11:15 pm
Location: Bremen, Germany

Re: Problem 222

Post by daniel.is.fischer »

No, it can't be that short.
Il faut respecter la montagne -- c'est pourquoi les gypaètes sont là.
User avatar
daniel.is.fischer
Posts: 2400
Joined: Sun Sep 02, 2007 11:15 pm
Location: Bremen, Germany

Re: Problem 222

Post by daniel.is.fischer »

axelbrz wrote:Hi, can anyone confirm me if the length in micrometers of the shortest pipe, of internal radius 50mm, that can fully contain 3 balls of radii 48mm, 49mm and 50mm, is 293949?

Thank you!
No, it's 293933.
Il faut respecter la montagne -- c'est pourquoi les gypaètes sont là.
x10
Posts: 8
Joined: Sun Jul 19, 2009 8:20 pm

Re: Problem 222

Post by x10 »

I'm sorry to be reiterating the topic, but could anyone please post their answer for balls of sizes 40, 41... 50?
I get 983801.638816
Image
User avatar
daniel.is.fischer
Posts: 2400
Joined: Sun Sep 02, 2007 11:15 pm
Location: Bremen, Germany

Re: Problem 222

Post by daniel.is.fischer »

Too close to the problem's parameters to post the correct value, but yours is too high, the correct value is 981xxx.yyyyy
Il faut respecter la montagne -- c'est pourquoi les gypaètes sont là.
mirzauzairbaig
Posts: 7
Joined: Sun Dec 27, 2009 11:35 pm

Re: Problem 222

Post by mirzauzairbaig »

Can anyone please list any particular basic topics that I need to go through to work on this problem ?
Last edited by mirzauzairbaig on Sat Mar 22, 2014 7:12 am, edited 1 time in total.
TripleM
Posts: 384
Joined: Fri Sep 12, 2008 3:31 am

Re: Problem 222

Post by TripleM »

The best part about Project Euler is that you need to come up with the answers all by yourself, you won't be finding hints online ;)

Let's just say that a brute force approach doesn't need to check all N!/2 possibilities.
User avatar
daniel.is.fischer
Posts: 2400
Joined: Sun Sep 02, 2007 11:15 pm
Location: Bremen, Germany

Re: Problem 222

Post by daniel.is.fischer »

Let's say a brute force approach is supposed to not be a good idea. Look at the function that gives you the length or saved length locally. It has a property which lets you find the optimal arrangement quite easily (assuming what you're studying is mathematics or has a large mathematical component, like physics).
Il faut respecter la montagne -- c'est pourquoi les gypaètes sont là.
TripleM
Posts: 384
Joined: Fri Sep 12, 2008 3:31 am

Re: Problem 222

Post by TripleM »

Or that. Either way gives a fast answer :)
jui-feng
Posts: 11
Joined: Thu Sep 02, 2010 5:20 pm

Re: Problem 222

Post by jui-feng »

x10 wrote:I'm sorry to be reiterating the topic, but could anyone please post their answer for balls of sizes 40, 41... 50?
I get 983801.638816
It's kind of funny I was getting exactly the same (invalid) response for 40-50. It seems like we both made the same mistake that resulted in the same result, I only had some more decimal places (double precision).

Anyway, I solved it now.
Image
User avatar
yourmaths
Posts: 47
Joined: Mon Aug 25, 2014 11:00 am

Re: Problem 222

Post by yourmaths »

One small quibble over the rounding of the final answer here. Let's say the answer to the problem is 123.4 micrometres. Rounding this (down since 0.4 < 0.5) we get 123 but this is no longer the shortest pipe since the sphere on top is now 0.4 micrometres above the top of the pipe. So my interpretation would be that the answer should be rounded up in all cases, giving 124, which was not accepted, but 123 was.
level = lambda number_solved: number_solved // 25
Image
DJohn
Posts: 90
Joined: Sat Oct 11, 2008 12:24 pm

Re: Problem 222

Post by DJohn »

yourmaths wrote: Fri May 08, 2026 9:53 pm One small quibble over the rounding of the final answer here. Let's say the answer to the problem is 123.4 micrometres. Rounding this (down since 0.4 < 0.5) we get 123 but this is no longer the shortest pipe since the sphere on top is now 0.4 micrometres above the top of the pipe. So my interpretation would be that the answer should be rounded up in all cases, giving 124, which was not accepted, but 123 was.
But that is not what the problem is asking for. What you're doing is finding the shortest integer length that satisfies the conditions. The problem is asking you to find the shortest length (which is not necessarily an integer) and then to round it to the nearest integer. That's a different thing. There's nothing in the problem statement that suggests that the rounded number has to meet any conditions other than being the closest integer to the shortest length.
Post Reply