## Problem 038

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
spen
Posts: 1
Joined: Sun Sep 05, 2010 8:15 pm

### Re: Problem 038

I still must be misunderstanding something. The solution is supposed to be the largest number, nine digits, permutation of 1..9, right? The largest number I get that meets all of the requirements given is given as one of the examples, and is not accepted as the right answer. I can generate 4 other candidates, each from a 3 digit number multiplied by (1, 2, 3). The two examples given are the highest and lowest numbers that I can generate, so I have 3 others.

What am I missing?

Slaunger
Posts: 40
Joined: Mon Jul 19, 2010 11:23 pm

### Re: Problem 038

Hi spen,

It appears to me that you understand the problem correctly, but have overlooked some candidates in your analysis. I do not know how many concatenated pandigital products with three, three-digit numbers there are as those never really caught my interest in the problem.

Slaunger

mury
Posts: 2
Joined: Mon Nov 07, 2011 11:27 am

### Re: Problem 038

People are talking about reverse order here (n,...,3,2,1), but as far as I understand the problem, we are looking for the closest to 999999999 number that can be formed as the concatenated product of an integer and one of the lists:
(1,2)
(1,2,3)
(1,2,3,4)
.............
(1,2,3,4,...,n)
Am I right?

TripleM
Posts: 382
Joined: Fri Sep 12, 2008 2:31 am

### Re: Problem 038

Yes. The problem used to be worded differently, thus the confusion in the earlier posts.

Yamaneko
Posts: 6
Joined: Wed Nov 14, 2012 9:54 pm
Location: Budapest, Hungary

### Re: Problem 038

I don't want to give away anything, but I have to tell you that I loved working on this one! At first I got sidetracked taking something for granted that I shouldn't have, and I got one of the pandigitals in the example, which of course wasn't the answer. Realising my supposition was wrong made me come up with better, more flexible code and also made me aware that I was overlooking some cases that I really shouldn't have. This time I loved being wrong. Cheers!

brunnock
Posts: 1
Joined: Tue Feb 05, 2013 12:38 pm

### Re: Problem 038

I believe the title is misspelled. I think it should be "multiple".

hk
Posts: 10403
Joined: Sun Mar 26, 2006 9:34 am
Location: Haren, Netherlands

### Re: Problem 038

Thanks, changed.

dunne
Posts: 5
Joined: Sat Mar 16, 2013 11:43 am
Location: Hamburg
Contact:

### Re: Problem 038

I am completely stuck on this. I can't for the life of me see why the second example is not the right answer -- and my program agrees with me! Does anyone feel like giving me a slight hint?

thundre
Posts: 356
Joined: Sun Mar 27, 2011 9:01 am

### Re: Problem 038

dunne wrote:I am completely stuck on this. I can't for the life of me see why the second example is not the right answer -- and my program agrees with me! Does anyone feel like giving me a slight hint?
The number of concatenated products can be anywhere from 2 to 9. Don't get in a rut thinking that they must all be the same number of digits.

dunne
Posts: 5
Joined: Sat Mar 16, 2013 11:43 am
Location: Hamburg
Contact:

### Re: Problem 038

thundre wrote:
dunne wrote:I am completely stuck on this. I can't for the life of me see why the second example is not the right answer -- and my program agrees with me! Does anyone feel like giving me a slight hint?
The number of concatenated products can be anywhere from 2 to 9. Don't get in a rut thinking that they must all be the same number of digits.
Thanks, thundre. I am sure I have avoided this problem. Here's what I am doing (hopefully not giving away too much -- I doubt it, since my method is clearly flawed!) :

I am taking from 1 to 4 (although I think 3 is the actual limit) of the most signficant digits in turn from each pandigital, and generating and concatenating the products one by one, using 1,2,3...9. I don't bother about the number of products or the number of digits in each product. I have a check that stops this generation/concatenation as soon as the pandigital is reached or exceeded. I am doing this for *all* pandigitals, starting with the biggest. I get valid results, but the highest is always the second example from the problem text.

thundre
Posts: 356
Joined: Sun Mar 27, 2011 9:01 am

### Re: Problem 038

dunne wrote: I am taking from 1 to 4 (although I think 3 is the actual limit) of the most signficant digits in turn from each pandigital, and generating and concatenating the products one by one, using 1,2,3...9. I don't bother about the number of products or the number of digits in each product. I have a check that stops this generation/concatenation as soon as the pandigital is reached or exceeded. I am doing this for *all* pandigitals, starting with the biggest. I get valid results, but the highest is always the second example from the problem text.
So you're checking all 9! pandigitals, or at least the ~8! which are greater than 918273645.

If instead of a pandigital you give it 666613332, does it acknowledge that it's 6666 * (1,2)?

dunne
Posts: 5
Joined: Sat Mar 16, 2013 11:43 am
Location: Hamburg
Contact:

### Re: Problem 038

thundre wrote: So you're checking all 9! pandigitals, or at least the ~8! which are greater than 918273645.

If instead of a pandigital you give it 666613332, does it acknowledge that it's 6666 * (1,2)?
I am *generating* all 9!, but since I sort before checking and start checking at the end of the array, I stop at the first one found, which by definition is the biggest.

I gave it that number, it *didn't* acknowledge it, and almost at once I knew exactly why! Thanks a lot thundre, just a simple coding error but without talking it through with someone I doubt I would have spotted it any time soon.

ubershmekel
Posts: 1
Joined: Mon Apr 30, 2018 7:26 am

### Problem 038

Take the number 192 and multiply it by each of 1, 2, and 3:
[..]
By concatenating each product we get the 1 to 9 pandigital, 192384576. We will call 192384576 the concatenated product of 192 and (1,2,3)
When I read through this problem, I didn't realize what "1 to 9 pandigital" meant until I submitted the wrong answer a few times. My impression was that "1 to 9 pandigital" meant a number with 9 digits that was created through that multiplication form. I would recommend revising the text to define pandigital. For example:
By concatenating each product we get the 1 to 9 pandigital (a number that contains all the digits 1-9), 192384576...

hk
Posts: 10403
Joined: Sun Mar 26, 2006 9:34 am
Location: Haren, Netherlands

### Re: Problem 038

Please don't start a new topic for a problem if there exists one already.

fistuk
Posts: 1
Joined: Sun Nov 11, 2018 11:06 am

### Re: Problem 038

sorry couldn't find the other post so I'm asking here:

I probably don't get something regarding pandigitals since I had the same problem at 032.

I get a better answer that only the 2nd best is being accepted.
So maybe can someone explain me what's bad with 2469 *4 and 2469 *5 ?

hk