The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Solving mathematical problems with Ruby

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Antonio Cangiano

Posts: 333
Nickname: acangiano
Registered: Dec, 2005

Antonio Cangiano is a Ruby hacker
Solving mathematical problems with Ruby Posted: Jan 30, 2006 5:23 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Antonio Cangiano.
Original Post: Solving mathematical problems with Ruby
Feed Title: Zen and the Art of Ruby Programming
Feed URL: http://programmingzen.com/category/ruby/feed/
Feed Description: Antonio Cangiano's blog about Ruby development.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Antonio Cangiano
Latest Posts From Zen and the Art of Ruby Programming

Advertisement

A couple of weeks ago I’ve discovered a very interesting and addictive website MathsChallenge.net . They have a section called Project Euler where participants can try to resolve more than 100 mathematical problems. The scoring system is really well done and the discussion forum for each problem is accessible only after having solved the given problem.

It’s interesting to see how other people try to figure out a solution and what languages they employ to solve the puzzling problems. I even discovered rare languages like J or K through this site. It’s like a martial arts contest where participants can use their favorite martial art, only this is for hackers. :-)

I’ve only spent a few hours over a couple of days on the site, enough time to solve 26 problems and bring me somewhere around 370th place out of more than 1300 active participants in the contest. I didn’t spend time solving problems during the last ten days, and in fact I am now 418th. I am going to work on more problems when I’ll have some time. I love this kind of stuff, and it’s not just for the enjoyable competition. It doesn’t really matter if you are first or last, especially if you know how to solve most of the problems but you are short of time like me. What’s important is to have fun and benefit from the learning process.

The programs must solve the given problems within 60 seconds (think of it like Gone in 60 Seconds), which means that most brute force methods won’t work.

This is particularly true for Ruby. In fact I have seen some people with C or Assembler resolve a problem with brute force algorithms, where Ruby would take way longer than a minute. There is no harm in this though, it’s a good exercise in controlling the algorithms’ complexity, facing problems that you don’t encounter too often in real world programming.

I use Ruby 1.8.4 so I even had to rewrite my own mathn library because prime computation and gcd are exceptionally slow (1.9 solves the problem though).

I invite you to join me and bring up Ruby statistics on MathsChallenge. And above all, have lots of fun…

Read: Solving mathematical problems with Ruby

Topic: Ruby Code and Style Editorial Previous Topic   Next Topic Topic: [EVALUATION] - E06 - RDOC REFRAMING

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use