Problem 004

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.

Re: Problem 004 (WARNING: NEWBIE)

Postby Georg » Tue Jul 14, 2009 7:50 am

You should edit your post and delete the source code.
User avatar
Georg
 
Posts: 83
Joined: Mon Jan 21, 2008 7:00 am
Location: Mannheim, Germany

Re: Problem 004

Postby pbear » Sat Sep 26, 2009 12:26 am

What's wrong with this code?

Code: Select all
39   for( x = 999; x >= 100; x-- ) {
40     for( y = 999; y >= x; y-- ) {
41       r = x * y;
42       printf("%u * %u = %u\n", x, y, r);
43
44       if( is_palindrome( r ) ){
45         printf("I has it: %d\n", r);
46         return 0;
47       }
48     }
49   }


It does yield a palindrome of six digits, and I can't see what is wrong here
pbear
 
Posts: 1
Joined: Sat Sep 26, 2009 12:17 am

Re: Problem 004

Postby TripleM » Sat Sep 26, 2009 12:41 am

If it yields a palindrome of 6 digits, and it tells you you have the wrong answer, then logically it cannot be the largest.
TripleM
 
Posts: 353
Joined: Fri Sep 12, 2008 2:31 am

Re: Problem 004

Postby daniel.is.fischer » Sat Sep 26, 2009 12:47 am

Exactly, there are 80 6-digit palindromes larger than what that code returns which are the product of two 3-digit numbers.
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 10:15 pm
Location: Bremen, Germany

Problem 4 possible error

Postby theslimzmassive » Fri Jan 08, 2010 10:32 am

Would i be wrong in saying the actual answer to problem 4 is 997799? The accepted answer is < snip >. The question is:

Find the largest palindrome made from the product of two 3-digit numbers.

999*999 = 998001 <- upper limit

so basically

< snip ><997799<(999*999)

ala < snip > is the wrong answer.
theslimzmassive
 
Posts: 1
Joined: Fri Jan 08, 2010 10:25 am

Re: Problem 004

Postby harryh » Fri Jan 08, 2010 11:14 am

Hi theslimzmassive,

Please do not post in this forum the answers or any spoilers for any problem; this forum is open to everyone (whether they have solved a particular problem or not), so spoilers are not allowed. As a result, I snipped the correct answer from your post.

As far as I can tell, the answer you propose (997799) is NOT the product of two three-digit numbers, so it cannot possibly be correct.

Finally, before starting a new thread (topic) in this forum, please make sure that -for the given problem- there is no previous topic on it. If a topic already exists, add your question to it.
harryh
 
Posts: 2091
Joined: Tue Aug 22, 2006 8:33 pm
Location: Thessaloniki, Greece

Problem 004

Postby Roxxor » Sat Jul 03, 2010 12:22 pm

Hello! I am new to Project Euler.

Problem 4 reads:
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.

Find the largest palindrome made from the product of two 3-digit numbers.


The biggest palindrome I can find with 3 digit numbers is:
Code: Select all
999*991=990009

But the correct answer is lower than my answer and is considered to be the correct one.
How come?
Roxxor
 
Posts: 2
Joined: Sat Jul 03, 2010 12:17 pm

Re: Problem 004

Postby harryh » Sat Jul 03, 2010 12:35 pm

A. Your answer is NOT palindromic. 990009, if read the other way round becomes 9000099.

B. Please do not start a new topic, if one exists for the same problem! (More often than not, you'll also find what you are looking for being there already...)
harryh
 
Posts: 2091
Joined: Tue Aug 22, 2006 8:33 pm
Location: Thessaloniki, Greece

Re: Problem 004

Postby Rakshasa » Sat Nov 06, 2010 6:10 pm

I've looked through both first few of the first and last pages of the solution thread, and none of them give any proper optimal solution. Would it be possible to temporarily unlock the thread for me to post a clean, readable and pretty damn fast example?
Rakshasa
 
Posts: 2
Joined: Sat Nov 06, 2010 5:50 pm

Re: Problem 004

Postby harryh » Sat Nov 06, 2010 7:01 pm

Have you also looked at the pdf for the problem?
If you have, and if you are absolutely certain that your method is faster than that, you can PM me your method.
We will then consider re-opening the thread.
harryh
 
Posts: 2091
Joined: Tue Aug 22, 2006 8:33 pm
Location: Thessaloniki, Greece

Re: Problem 004

Postby Rakshasa » Sat Nov 06, 2010 7:45 pm

harryh wrote:Have you also looked at the pdf for the problem?
If you have, and if you are absolutely certain that your method is faster than that, you can PM me your method.
We will then consider re-opening the thread.

Looked at it and yes, my solution would appear to be more optimal. PM sent.
Rakshasa
 
Posts: 2
Joined: Sat Nov 06, 2010 5:50 pm

Re: Problem 004

Postby AcousticBruce » Thu Dec 16, 2010 7:03 am

Since I cant post code. I am unsure how to ask what I did wrong.
My code seems correct to me, but it is obvious that Project Euler feels different. Im sure I have the error :)

I see that some people have the code hidden. How do I do this? Or better yet should I do that?

I am a Java programmer. Can you help me? How do I show someone the code to see what I did wrong?
AcousticBruce
 
Posts: 1
Joined: Thu Dec 16, 2010 6:56 am

Re: Problem 004

Postby Lord_Farin » Thu Dec 16, 2010 7:20 am

You can send me a PM with your code, then I will look into it.
Image
User avatar
Lord_Farin
 
Posts: 239
Joined: Wed Jul 01, 2009 9:43 am
Location: Netherlands

Re: Problem 004

Postby nogo » Thu Feb 03, 2011 10:47 pm

Maybe anyone is willing to look through my code too?
It's written in Java and works well for 2-digit-numbers, for 3-digit-numbers I even have 2 solutions - depending on whether a "word" with an uneven number of characters is accepted as an palindrom or not.
However, nether of those solutions is accepted, and I cannot see where the problem is...
nogo
 
Posts: 2
Joined: Thu Feb 03, 2011 10:38 pm

Re: Problem 004

Postby TripleM » Fri Feb 04, 2011 12:19 am

Sure.
TripleM
 
Posts: 353
Joined: Fri Sep 12, 2008 2:31 am

PreviousNext

Return to Clarifications on Project Euler Problems

Who is online

Users browsing this forum: No registered users and 2 guests