## 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

Don't post any spoilers
Comments, questions and clarifications about PE problems.

### Re: Problem 004 (WARNING: NEWBIE)

You should edit your post and delete the source code.

Georg

Posts: 129
Joined: Mon Jan 21, 2008 8:00 am
Location: Mannheim, Germany

### Re: Problem 004

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);4344       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 1:17 am

### Re: Problem 004

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: 358
Joined: Fri Sep 12, 2008 3:31 am

### Re: Problem 004

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à.

daniel.is.fischer

Posts: 2400
Joined: Sun Sep 02, 2007 11:15 pm
Location: Bremen, Germany

### Problem 4 possible error

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 11:25 am

### Re: Problem 004

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 9:33 pm
Location: Thessaloniki, Greece

### Problem 004

Hello! I am new to Project Euler.

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 1:17 pm

### Re: Problem 004

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 9:33 pm
Location: Thessaloniki, Greece

### Re: Problem 004

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 6:50 pm

### Re: Problem 004

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 9:33 pm
Location: Thessaloniki, Greece

### Re: Problem 004

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 6:50 pm

### Re: Problem 004

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 7:56 am

### Re: Problem 004

You can send me a PM with your code, then I will look into it.

Lord_Farin

Posts: 239
Joined: Wed Jul 01, 2009 10:43 am
Location: Netherlands

### Re: Problem 004

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 11:38 pm

### Re: Problem 004

Sure.
TripleM

Posts: 358
Joined: Fri Sep 12, 2008 3:31 am

PreviousNext

Return to Clarifications on Project Euler Problems

### Who is online

Users browsing this forum: No registered users and 4 guests