Coder Profile - Show off your skills, get a coder profile.
 
 
 
  
Posted: 4.35 Years Ago 

Cinjection
Canada
Contrib Level: 11
Total Posts: 1,587
I found a site that has about 200 mathematical/computer science programming challenges. They have varying difficulty of problems, so everyone can find something to do. The challenges are based on mathematics, so it is a brilliant introduction to computer science courses in university.

I would recommend it to all of you. Except for Scott. He's not allowed to play with the other programmers until the next update comes out.

http://projecteuler.net/index.php?section=about
Posted: 4.34 Years Ago 

VBAssassin
United Kingdom
Contrib Level: 17
Total Posts: 5,730
QUOTE:  Remove Scroll Bars
Except for Scott. He's not allowed to play with the other programmers until the next update comes out.


Although it is finished as we speak and ready to upload on Monday... i'm just sorting out the next 3 months of updates and what they will be.

I might shift the challenges section a little higher in the list so that gets done sooner

That website is brilliant! I like this idea: http://projecteuler.net/index.php?section=statistics

In the next update.. you select your country... so i will be able to produce that kind of data

Also... might be a good idea to base the new challenges section i do here with a system similar to that (which already works). Obviously with some improvements and other modifications.

What would you say that website lacks for challenge management?

Kind regards,
Scott
Posted: 4.34 Years Ago 

Cinjection
Canada
Contrib Level: 11
Total Posts: 1,587
Post Quote - Direct Reference
QUOTE:  Remove Scroll Bars
Although it is finished as we speak and ready to upload on Monday... i'm just sorting out the next 3 months of updates and what they will be.
Lol. Nice to hear Scott. I really admire all the work you put into this site. Go you.
QUOTE:  Remove Scroll Bars
What would you say that website lacks for challenge management?
I'm not sure, I haven't been on it long enough to figure that out. I'll let you know as soon as I see a flaw.


I just finished my fourth one.
One of the best things about this site is that it stresses good algorithm design. For example, I had an original solution that worked, but generated the solution in about 1:30 minutes. The project states and pretty much every challenge can be done in under one minute, so I went back and changed my algorithm. The new one completed in under 20 seconds.

By the way, the challenge I'm talking about was this:
QUOTE:  Remove Scroll Bars
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.

What is the smallest number that is evenly divisible by all of the numbers from 1 to 20?
Posted: 4.34 Years Ago 

VBAssassin
United Kingdom
Contrib Level: 17
Total Posts: 5,730
QUOTE:  Remove Scroll Bars
Lol. Nice to hear Scott. I really admire all the work you put into this site. Go you.
Haha, thanks
QUOTE:  Remove Scroll Bars
I'm not sure, I haven't been on it long enough to figure that out. I'll let you know as soon as I see a flaw.
Thanks
QUOTE:  Remove Scroll Bars
2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.

What is the smallest number that is evenly divisible by all of the numbers from 1 to 20?
Hmmm....

I'm gonna write that down... and take it to the show tomorrow so me and matt can work on it

Give us something to do for a few minutes hehe

Kind regards,
Scott
Posted: 4.34 Years Ago 

Ben
Afghanistan
Contrib Level: 5
Total Posts: 130
I signed up to Project Euler a while a go, it's a good site. I've solved over 50, some of them in multiple programming languages. It's quite fun.
Posted: 4.34 Years Ago 

Cinjection
Canada
Contrib Level: 11
Total Posts: 1,587
Post Quote - Direct Reference
I'm doing them all in Scheme. It gives me a nice way to get comfortable with the language.
Posted: 4.34 Years Ago 

Arcube
China
Contrib Level: 5
Total Posts: 174
That's a pretty nice website, thanks for the link
Posted: 4.34 Years Ago 

Cinjection
Canada
Contrib Level: 11
Total Posts: 1,587
Post Quote - Direct Reference
Some of them are fairly straightforward, but the straightforward approach is usually very slow. The goal it really to design an efficient algorithm to solve the problem, not just solve the problem.

For instance, one of them involved summing all the even Fibonacci numbers below one million. An obvious approach is to design a recursive process to calculate the value. Simple enough. but the tree recursion this produces is extremely slow. Much better solution is to make an iterative process to generate the Fibonacci numbers.
Posted: 4.34 Years Ago 

VBAssassin
United Kingdom
Contrib Level: 17
Total Posts: 5,730
QUOTE:  Remove Scroll Bars
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.
The answer
CODE: Copy / Restore  ::  Remove Scroll Bars
  1. $results_array = array();
  2.  
  3. //3 times table
  4. for ($counter = 1; 3 * $counter < 1000; $counter++) {
  5.        $results_array[3 * $counter] = '';
  6. }
  7. for ($counter = 1; 5 * $counter < 1000; $counter++) {
  8.        $results_array[5 * $counter] = '';
  9. }
  10.  
  11. $tmp = 0;
  12. foreach ($results_array as $num=>$val) {
  13.        $tmp += $num;
  14. }
  15.  
  16. print "{$tmp}<br /><br />";
  17.  
  18. print '<pre>';
  19. ksort($results_array);
  20. print_r($results_array);
  21. print '</pre>';
and works in under 60 seconds    in fact works in under 1 second   

I have not optimized it or anything... so feel free if you want to post an optimized version of the code.

Kind regards,
Scott
Posted: 4.34 Years Ago 

Ben
Afghanistan
Contrib Level: 5
Total Posts: 130
Post Quote - Direct Reference
Wow, that seems a very strange way to do it. If you just want to do a simple brute force like that in PHP, why not do something like:
CODE: Copy / Restore  ::  Remove Scroll Bars
  1. <?php
  2. $sum = 0;
  3. for ($i = 1; $i < 1000; $i++) {
  4.        if ($i%3 == 0 || $i%5 == 0) $sum += $i;
  5. }
  6. echo $sum;
  7. ?>
Posted: 4.34 Years Ago 

VBAssassin
United Kingdom
Contrib Level: 17
Total Posts: 5,730
Haha... much better than what i posted... told you it could have been optimized

Anyway was going to use the modulus but couldn't remember how to use it lmao... did it at like 9AM after getting about 5 hours sleep!

So broke it down in to many small steps.

Looking back though there are 2 other ways i can now think of doing it where both would have been less code than the originally   

Kind regards,
Scott
Page of 7 :: Next Page >>
 
 
Latest News About Coder Profile
Coder Profile Poll
Which sounds better on your coder profiles, and makes more sense to you (think twitter, facebook, etc)?

Followers / Following
Fans / Following
Fans / Fan Of


please login to cast your vote
and see the results of this poll
Latest Coder Profile Changes
Coder Profile was last updated
3.49 Years Ago
Official Blog :: Make A Donation :: Credits :: Contact Me
Terms & Conditions :: Privacy Policy :: Documents :: Wallpapers
Version 1.46.00
Copyright © 2007 - 2012, Scott Thompson, All Rights Reserved