Problem 219

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.
Post Reply
User avatar
GoSlow2GoFast
Posts: 11
Joined: Fri Nov 07, 2008 3:31 am

Problem 219

Post by GoSlow2GoFast »

I thought I had this figured out, but my answer doesn't check out, so I wonder if I'm missing something. Can anyone confirm if these values would be correct?

C(4)=20
C(5)=27
C(6)=35
C(7)=44
C(8)=54
C(9)=65

~gs2gf
Ikcelaks
Posts: 28
Joined: Wed Oct 15, 2008 9:08 pm

Re: Problem 219 Skew-cost coding

Post by Ikcelaks »

C(4) should be computable by hand. Try it.
User avatar
GoSlow2GoFast
Posts: 11
Joined: Fri Nov 07, 2008 3:31 am

Re: Problem 219 Skew-cost coding

Post by GoSlow2GoFast »

Yes, agreed. I had done the following to come up with C(4) = 20, am I missing something?

00, 01, 10, 11
4*4 + 4 = 20

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

Re: Problem 219 Skew-cost coding

Post by harryh »

Isn't it cheaper to choose:
000, 001, 01, 1 ?
(it only costs 4*3+6=18)
User avatar
GoSlow2GoFast
Posts: 11
Joined: Fri Nov 07, 2008 3:31 am

Re: Problem 219 Skew-cost coding

Post by GoSlow2GoFast »

So under that approach, an alternative minimum cost solution to C(6) would be.

00000, 00001, 0001, 001, 01, 1
5*4 + 15 = 35

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

Re: Problem 219 Skew-cost coding

Post by harryh »

That's true; no one claims that the solution for minimum cost has to be unique.
User avatar
GoSlow2GoFast
Posts: 11
Joined: Fri Nov 07, 2008 3:31 am

Re: Problem 219 Skew-cost coding

Post by GoSlow2GoFast »

But that approach seems to break down for C(8) where starting with "11" rather than "1" yields a minimal cost.

000001, 000000, 00001, 0001, 001, 01, 10, 11
8*4 + 22 = 54

0000000, 0000001, 000001, 00001, 0001, 001, 01, 1
7*4 + 28 = 56

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

Re: Problem 219 Skew-cost coding

Post by harryh »

Clearly then, "that approach" does not always produce a minimum cost.
quilan
Posts: 182
Joined: Fri Aug 03, 2007 11:08 pm

Re: Problem 219 Skew-cost coding

Post by quilan »

Hrmm, it's frustrating to have a wonderful algorithm that I can't submit until Monday when I get to work. It looks like it's perfect.

Edit: I'm glad I had a background in compression technologies. Certainly helpful here.
ex ~100%'er... until the gf came along.
Image
User avatar
Assato
Posts: 13
Joined: Sun Apr 19, 2009 4:21 pm

Re: Problem 219

Post by Assato »

I think I'm doing something wrong here... I get the right answer for n = 6 and for n = 8, but a wrong answer for 10^9.

Can anyone confirm my values for:

Cost(1000) = 62054
Cost(10^6) = 1888115810

Thanks a lot.

Edit: Nevermind, found my mistake (and my values were wrong, for future reference). Correct values should be:

Cost(1000) = 21708
Cost(1e6) = 43137383
Post Reply