## Problem 524

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
phsr
Posts: 27
Joined: Tue Dec 15, 2009 12:00 am

### Problem 524

Maybe this is obvious, but does 'lexicographic order' include delimiters?

Does {102,41...} sort before or after {1024,2...}?
TripleM
Posts: 382
Joined: Fri Sep 12, 2008 3:31 am

### Re: Problem 524

No. You're ordering the permutations as lists, not as alphanumeric strings.
phsr
Posts: 27
Joined: Tue Dec 15, 2009 12:00 am

### Re: Problem 524

Just to be absolutely clear: the lexicographic order for the numbers from 1 to 20 is

1,10,11,12,13,14,15,16,17,18,19,2,20,3,4,5,6,7,8,9. Do we agree??
jaap
Posts: 554
Joined: Tue Mar 25, 2008 3:57 pm
Contact:

### Re: Problem 524

phsr wrote:Just to be absolutely clear: the lexicographic order for the numbers from 1 to 20 is

1,10,11,12,13,14,15,16,17,18,19,2,20,3,4,5,6,7,8,9. Do we agree??
No.
Think of each number in a list as a single letter in a word.
(2,3,4)<(10,1,1)<(10,1,2)<(10,4,1)<(11,3,3)<(104,1,2)<(1030,0,0)

Each 'coordinate' is sorted numerically, and lexicographic refers to how you deal with more than one coordinate - left to right, until the first coordinate where there is a difference, just like the letters of a word when sorting alphabetically.

https://en.wikipedia.org/wiki/Lexicographical_order