Problem 223 & 224

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.
Darhuuk
Posts: 2
Joined: Sun Jan 18, 2009 9:04 pm

Problem 223 & 224

Post by Darhuuk »

Hi,

I haven't solved problems 223 & 224 yet, but it seems to me the wording is a little misleading. More specifically, I think that instead of
a <= b <= c
it should say
1 < a <= b <= c
Otherwise, problem 223 is trivial, keep a = 1, b = c. Well, not trivial, I realize there's more solutions than that.

Of course, maybe I misunderstood and that is in fact supposed to be one of the solutions.

User avatar
hk
Administrator
Posts: 10883
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Wording Problem 223 & 224

Post by hk »

Moved it here.....
Image

User avatar
rayfil
Administrator
Posts: 1405
Joined: Sun Mar 26, 2006 5:30 am
Location: Quebec, Canada
Contact:

Re: Wording Problem 223 & 224

Post by rayfil »

The wording used for a problem description is reviewed thouroughly in all its details by several people (at least three), before a problem is published, to make sure it is fully accurate and prevent any misunderstanding.

What you see is what you have to work with.
When you assume something, you risk being wrong half the time.

ansrivas
Posts: 5
Joined: Sun Feb 03, 2008 4:56 pm

Re: Problem 223 & 224

Post by ansrivas »

Can somebody confirm if the answer to 224 for perimeter<=9e6 is 496403.
Thanks.

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

Re: Problem 223 & 224

Post by daniel.is.fischer »

Yes.
Il faut respecter la montagne -- c'est pourquoi les gypa&egrave;tes sont l&agrave;.

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

Re: Problem 223 & 224

Post by axelbrz »

Hi,

Do I have to take only the (a, b, c) triplet for which a < b + c, b < a + c, c < a + b and 1 <= a?

I mean, should I be able to construct a triangle with sides a, b, c?

Thanks.
Last edited by axelbrz on Wed Jun 24, 2009 12:18 am, edited 1 time in total.
"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 223 & 224

Post by daniel.is.fischer »

"Let us call an integer sided triangle with sides a &le; b &le; c", so yes.
Il faut respecter la montagne -- c'est pourquoi les gypa&egrave;tes sont l&agrave;.

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

Re: Problem 223 & 224

Post by axelbrz »

Oh! sorry, and thanks! :)
"think(O(n))+O(n) sometimes is better than think(O(1))+O(1)"

Image

zwuupeape
Posts: 189
Joined: Tue Jun 09, 2009 6:11 pm

Re: Problem 223 & 224

Post by zwuupeape »

Hey, I have a question about 224... I solved 223 but it took me almost half an hour to compute the results (my algorithm is identical to that used by others, code optimized by some methods, and I use external modules for some mathematical functions that are very efficient). Python, yes. 224 is not very different - I know exactly how to solve it and it will probably work fine if I give it like, say, 7 hours. Is there something I missed or is this problem supposed to be more demanding from the computer than 223?

User avatar
Georg
Posts: 157
Joined: Mon Jan 21, 2008 7:00 am
Location: Mannheim, Germany
Contact:

Re: Problem 223 & 224

Post by Georg »

For me problem 224 was easier than problem 223. I used nearly the same code and I had no problems [...] Runs in 10 seconds. (Java)

zwuupeape
Posts: 189
Joined: Tue Jun 09, 2009 6:11 pm

Re: Problem 223 & 224

Post by zwuupeape »

Okay, I've solved it. There's a really smart solution (and I found that solution in a VERY dumb way), and there actually is a semi-smart solution that I didn't think of, but this semi-smart solution is much more difficult to find than the semi-smart solution for 223. :)

viv_ban
Posts: 23
Joined: Mon May 26, 2008 3:09 pm

Re: Problem 223 & 224

Post by viv_ban »

Can somebody please confirm the number of solutions for perimeter < 10^4 is equal to 13656

harryh
Posts: 2091
Joined: Tue Aug 22, 2006 9:33 pm
Location: Thessaloniki, Greece

Re: Problem 223 & 224

Post by harryh »

Yes, viv_ban, your answer for Problem 223 (View Problem) and perimeter &le;10000, seems to be correct. :D

paulwise3
Posts: 6
Joined: Tue Mar 25, 2014 4:35 pm

Re: Problem 223 & 224

Post by paulwise3 »

That is strange, for (a+b+c) <= 10000 I get 13651. That is, I haven't found a solution yet, and certainly not an efficient one.
I suppose nobody can give me a hint?
Edit: ah, I used a < b < c instead of a <= b <= c. Now I have 13656 too. But still too slow to get anywhere near 25.000.000 :-(.

User avatar
Oliver1978
Posts: 166
Joined: Sat Nov 22, 2014 9:13 pm
Location: Erfurt, Germany

Re: Problem 223 & 224

Post by Oliver1978 »

Let us call an integer sided triangle with sides a <= b <= c barely acute if the sides satisfy a^2 + b^2 = c^2 + 1.
So, if a = 1then I get approximately 12.5 million positive results*: 1^2 + b^2 = c^2 + 1, with b = c. Also a = 1 is not excluded in the description, so how can 10^4 be 13,656? :shock:

* with a perimeter <= 25,000,000
49.157.5694.1125

User avatar
Georg
Posts: 157
Joined: Mon Jan 21, 2008 7:00 am
Location: Mannheim, Germany
Contact:

Re: Problem 223 & 224

Post by Georg »

Because there are more triangles than perimeterlimit/2.

User avatar
Oliver1978
Posts: 166
Joined: Sat Nov 22, 2014 9:13 pm
Location: Erfurt, Germany

Re: Problem 223 & 224

Post by Oliver1978 »

I think I've found my mistake...

So, with a perimeter <= 20,000 that would make 29257 triangles?
49.157.5694.1125

User avatar
Georg
Posts: 157
Joined: Mon Jan 21, 2008 7:00 am
Location: Mannheim, Germany
Contact:

Re: Problem 223 & 224

Post by Georg »

Yes.

User avatar
youth4ever
Posts: 11
Joined: Sun Jan 08, 2017 8:34 pm
Contact:

Re: Problem 223 & 224

Post by youth4ever »

Hi,

I have written 2 pieces of code for problem 223.
I get two different answers , for the perimeter limit = 100.000 I get :
val1 = 168921 , val2 = 168676
EDIT : I also get val3 = 168350 when I try to optimize.

Can you please tell me which one is correct ?
Thanks.

User avatar
jaap
Posts: 551
Joined: Tue Mar 25, 2008 3:57 pm
Contact:

Re: Problem 223 & 224

Post by jaap »

youth4ever wrote:
Sat Oct 28, 2017 3:19 pm
I have written 2 pieces of code for problem 223.
I get two different answers , for the perimeter limit = 100.000 I get :
val1 = 168921 , val2 = 168676
I can't find my code for this problem right now.
What you could do is have your computer compare the triangles generated by the two methods until you find one that is counted by method 1 but not by method 2. It is easily checked whether that is a valid almost right-angled triangle or not, so you then know see whether method 1 falsely includes it or method 2 falsely excludes it. The same then goes for your optimized method.

Post Reply