### Author Topic: Project Euler  (Read 137844 times)

#### Dr Kevin Wang

• Full Member
• Posts: 129
##### Re: Project Euler
« Reply #15 on: 一月 30, 2008, 11:17:11 pm »
I solved #176 and #179, and those still count as one each. I think they should have some kind of weight system and give more point for the harder problems.  For example, 1 point for problems 1-9, 2 points for problems 10-99, 3 points for problems 100+, etc.

#### 万精油

• Hero Member
• Posts: 1831
##### Re: Project Euler
« Reply #16 on: 一月 31, 2008, 10:02:47 am »
Quote
62 now; got within 900.

Great! One more MATLAB player in the top 1000. From the statistics, C/C++ wins by far. The next one is Python, which is just a free version of MATLAB (very similar to MATLAB, I heard).

Quote
I did the 100! and 2^1000 problems the same way. Also there is a problem about finding maximum digital sum for a^b (1<=a,b<=100).

I think these are the only three problems I used that approach.

Quote
Many people in the forum there used the big number capabilities of languages (Java, Python, Ruby, Mathematica ...), which I also regard as cheating  A few solutions from other people did surprise me for their elegance.

Many C/C++ users will think MATLAB is cheating too. . My view is that if I know how to do it in that approach, then I have proved I can do it,  I don't have to do it for every problem with the slow approach.

BTW, I didn't know there's a forum until you mentioned it. I went in and checked, it is a great forum, but where do people discuss these problems? There are quite a few subforums, which one do they use to discuss these problems?

I think they should have a contest on what is the shortest code for each problem. I may win a couple of problems for the shortest solution. I have four problem solutions under 30 charactors, and two of them under 15.

Quote
The reason I admire Prof. W so much is that he is at the very top at everything he does.

I wish this was true. The fact is that I suck at many things I do.

Quote
I solved #176 and #179, and those still count as one each. I think they should have some kind of weight system and give more point for the harder problems.  For example, 1 point for problems 1-9, 2 points for problems 10-99, 3 points for problems 100+, etc.

After I got on the top 1000, I started to do problems by their natural order. There is no reason for me to select later ones, since I will meet them later anyway. Now, I have solved every problem from 1 to 59, the next one will be No. 60.

My question is how do we get to the top? Suppose I solve all the problems some day, I will still be behind to those who solve those problems earlier.

#### Dr Kevin Wang

• Full Member
• Posts: 129
##### Re: Project Euler
« Reply #17 on: 一月 31, 2008, 11:27:23 am »
Quote
62 now; got within 900.

Great! One more MATLAB player in the top 1000. From the statistics, C/C++ wins by far. The next one is Python, which is just a free version of MATLAB (very similar to MATLAB, I heard).

I marked myself as "Pencil/Paper"

Quote
BTW, I didn't know there's a forum until you mentioned it. I went in and checked, it is a great forum, but where do people discuss these problems? There are quite a few subforums, which one do they use to discuss these problems?
There's a forum where they DON'T discuss the problems? I didn't know that
I just clicked on the column to the right of the green checkmark. It will be the forum where people discuss how they solved the problem and show code.

#### 万精油

• Hero Member
• Posts: 1831
##### Re: Project Euler
« Reply #18 on: 一月 31, 2008, 12:56:17 pm »
Quote
I marked myself as "Pencil/Paper"

Then you are cheating when you use programs. .

Actually, many problems there needs to be tried out with pencil/paper first.

Quote
There's a forum where they DON'T discuss the problems? I didn't know that
I just clicked on the column to the right of the green checkmark. It will be the forum where people discuss how they solved the problem and show code.

Ahh, we are learning from each other. Very good. I didn't know the area right of the green checkmark was clickable. Now I know and will certainly take a look at some of the problems. That's a good way to communicate while not allowing people who haven't solved that problem to see them.

Now, here's the fun part. This project actually has a seperate forum where they discuss all sort of math problems, programming problems and so on. A very good site. I didn't know it exist until you mentioned some kind of discussion place in your post. I went and look and found it. I thought that's the one you were talking about. OK, here it is:

Project Euler forum

#### 万精油

• Hero Member
• Posts: 1831
##### Re: Project Euler
« Reply #19 on: 二月 01, 2008, 11:40:04 am »
Quote
With the factor function in matlab, I computed the phi function up to 1 million in a couple hours. I didn't know about "factor" until I saw your num of divisors line.

I estimated it will take 2 days for my code to computer phi up to 1 million, and I don't have patient to wait for that long. So I get around it by not computing it (problem 69). However, problem 72 comes in, and I cannot avoid it any more. I designed a new approach, and now, my phi function can compute phi up to 1 million in about 5 minutes. Really happy.

#### Dr Kevin Wang

• Full Member
• Posts: 129
##### Re: Project Euler
« Reply #20 on: 二月 04, 2008, 03:04:45 am »
My question is how do we get to the top? Suppose I solve all the problems some day, I will still be behind to those who solve those problems earlier.&nbsp;

If you solve all the problems, then when the next problem comes out you solve it first, then you will be on top.

Is there a way to prevent those spammers from posting?  (Filters, etc.)

#### 万精油

• Hero Member
• Posts: 1831
##### Re: Project Euler
« Reply #21 on: 二月 04, 2008, 09:29:58 am »
Quote
If you solve all the problems, then when the next problem comes out you solve it first, then you will be on top.

I thought that was the case, but the top one stays there after two new problems. So, I thought I was wrong until today when I noticed the top has changed after problem 180. Good, we have some hope.

When I solved 72 problems, I noticed a familar name among people who also solved 72 problems, i.e. supertramp. There used to be an active ID in this forum with that name, and from his post here, he's good in programming. I am almost certain that these two are the same person. I have sent him a note to the register email address, hopefully, he will come back to this forum to join discussion with us.

Quote
Is there a way to prevent those spammers from posting?  (Filters, etc.)

Not really, I always get rid of them by hand. Fortunately, we don't have them very often, once a week on average.

#### jeff_gao

• Jr. Member
• Posts: 35
##### Re: Project Euler
« Reply #22 on: 二月 05, 2008, 10:17:50 am »
Haven't posted for a while, but I do read the forum regularly.

These problems interest me, so I set my goal to get into top 1000 before Super Tuesday. I did last night with 74 solved, rank 673 as of today!
Jeff G

#### 万精油

• Hero Member
• Posts: 1831
##### Re: Project Euler
« Reply #23 on: 二月 05, 2008, 10:39:01 am »
Hurray. Another Five Star Red Flag!

From what I can tell (from the first post of the first problem), this project has been there more than 3 years. I found out this project on January 14th, 2008, and gave the link here on January 16th (after I tried the first 15 problems and determined it was worth the effort). Now, 22 days later, I have solved 79 problems. An average of 3.6 problem a day. The problem is getting harder as we move along, it will not be possible to solve 3.6 problems each day. One problem a day might be manageable, but may not be true after another week.

Anyway, it is good to see more people are interested in this project. I am surprised FZY hasn't jumped in yet. He's very good in both puzzle solving and programming. This is exactly his cup of tea.

ID94, may be you can post a link in WenXueCity puzzle forum, and get more people interested.

« Last Edit: 二月 06, 2008, 11:21:32 am by 万精油 »

#### fzy

• Hero Member
• Posts: 520
##### Re: Project Euler
« Reply #24 on: 二月 05, 2008, 01:37:37 pm »
I have been extremely busy the past couple of months, and may get more so now. I did come here regularly and read the posts, but do not have time for anything else. I also followed the link to the site, but decided not to register since I would not have the time to do much. May be some of us can form a group and collectively solve the problems. How about that, ID94?

#### idiot94

• Sr. Member
• Posts: 484
##### Re: Project Euler
« Reply #25 on: 二月 06, 2008, 05:50:18 pm »
Of course, my master!

If I team up with you and Prof. W and SiYue, LOL ... I do not have to anything, but my rank will be top 99% in no time

I believe my login name is
idiot94
my pwd is
XXXXXX
(project Euler, huh? )
« Last Edit: 二月 06, 2008, 07:42:11 pm by 万精油 »
In general, the men of lower intelligence won out. Afraid of of their own shortcomings ... they boldly moved into action. Their enemies, ...  thought there was no need to take by action what they could win by their brains. Thucydides, History

#### 万精油

• Hero Member
• Posts: 1831
##### Re: Project Euler
« Reply #26 on: 二月 06, 2008, 07:43:58 pm »
ID94, it is not a good idea to leave your password publicly. You never know who's reading this and what they can do. I edited out your password, replaced them with XXXXXX. You can leave a private message to fzy about your password.

#### idiot94

• Sr. Member
• Posts: 484
##### Re: Project Euler
« Reply #27 on: 二月 06, 2008, 09:58:26 pm »
Thanks a lot, Prof. W. I am too careless indeed. I will PM fzy on that.
In general, the men of lower intelligence won out. Afraid of of their own shortcomings ... they boldly moved into action. Their enemies, ...  thought there was no need to take by action what they could win by their brains. Thucydides, History

#### shortstop

• Newbie
• Posts: 4
##### Re: Project Euler
« Reply #28 on: 二月 07, 2008, 10:07:18 am »
Quote
I solved 21 of them so far, now I'm 12% genius

I googled #14. All the others are done by hand or a matlab program.  Some of the remaining ones could be easily done by programs, but I didn't have time to work on them.

I spent two evenings and solved the first 25 problems, then, some scattered later problems. e.g. if you solve No. 18, you can solve No. 67, it's the same problem, just bigger size. And I really like my solution to this problem.

I think I have solved total of 32 so far. All of them are done by MATLAB. #14 can be done by MATLAB quickly. Most of them are interesting, but some of them are tedious.

#### shortstop

• Newbie
• Posts: 4
##### Re: Project Euler
« Reply #29 on: 二月 07, 2008, 10:28:31 am »
Quote
I solved 21 of them so far, now I'm 12% genius

I googled #14. All the others are done by hand or a matlab program.  Some of the remaining ones could be easily done by programs, but I didn't have time to work on them.

I spent two evenings and solved the first 25 problems, then, some scattered later problems. e.g. if you solve No. 18, you can solve No. 67, it's the same problem, just bigger size. And I really like my solution to this problem.

I think I have solved total of 32 so far. All of them are done by MATLAB. #14 can be done by MATLAB quickly. Most of them are interesting, but some of them are tedious.

Prof. W:

I spent 2 evenings on this and have solved 12 so far. As you mentioned, probs 18 & 67 are basically the same problem. I think the algorithm is pretty simple, however  I am kinda frustrated to get answers right. Would you just please check it for me.

Here is my code in Java:
int sum = data[0][0];
System.out.println("data[0][0] = " + data[0][0] + "--- sum = " + sum);
int i = 0;
for (int j = 1; j < index; j++) {
if (data[j] < data[j][i+1]) {
sum += data[j][i+1];
i++;
}
else {
sum += data[j];
}
System.out.println("data["+j+"]["+i+"] = " + data[j]+ "--- sum = " + sum);
}
System.out.println("the maximum sum traveling from the top of the triangle to the base is " +  sum);

For prob 18, index = 15 and output as follows
data[0][0] = 75--- sum = 75
data[1][0] = 95--- sum = 170
data[2][1] = 47--- sum = 217
data[3][2] = 87--- sum = 304
data[4][2] = 82--- sum = 386
data[5][3] = 75--- sum = 461
data[6][3] = 73--- sum = 534
data[7][3] = 28--- sum = 562
data[8][4] = 83--- sum = 645
data[9][4] = 47--- sum = 692
data[10][5] = 43--- sum = 735
data[11][5] = 73--- sum = 808
data[12][6] = 91--- sum = 899
data[13][6] = 67--- sum = 966
data[14][7] = 98--- sum = 1064
the maximum sum traveling from the top of the triangle to the base is 1064

Why 1064 isn't correct?

Thanks a lot!

shortstop.
« Last Edit: 二月 07, 2008, 10:55:36 am by shortstop »