Project Euler Problem 2

October 5th, 2009 Dallas No comments

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:

1, 2, 3, 5, 8, 13, 21, 34, 55, 89, …

Find the sum of all the even-valued terms in the sequence which do not exceed four million.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace Project_Euler_2
{
 class Program
 {
  static void Main(string[] args)
  {
   new Program();
  }
 
  Program()
  {
   List<ulong> fibonacciSequence = new List<ulong>();
   fibonacciSequence.Add(0);
   fibonacciSequence.Add(1);
 
   ulong sum = 0;
   bool isDone = false;
 
   for (int i = fibonacciSequence.Count; !isDone ; i++)
   {
    ulong nextFibonacciNumber = fibonacciSequence[i - 1] + fibonacciSequence[i - 2];
 
    fibonacciSequence.Add(nextFibonacciNumber);
 
    if(nextFibonacciNumber > 4000000)
     isDone = true;
    else
     if (nextFibonacciNumber % 2 == 0)
      sum += nextFibonacciNumber;
   }
 
   Console.WriteLine(sum);
   Console.ReadKey();
  }
 }
}
Categories: Project Euler Tags: ,

Project Euler Problem 1

October 5th, 2009 Dallas No comments

To keep the mental gears spinning I’m going through the Project Euler problems.  I’m going to solve them primarily in C#, but I may jump between languages depending on the problem.

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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace Project_Euler_1
{
 class Program
 {
  static void Main(string[] args)
  {
   new Program();
  }
 
  Program()
  {
   int sum = 0;
 
   for (int i = 1; i < 1000; i++)
    if (i % 3 == 0 || i % 5 == 0)
     sum += i;
 
   Console.WriteLine(sum);
   Console.ReadKey();
  }
 }
}
Categories: Project Euler Tags: ,

Battleopolis / Grant’s Ants / Ants / Arcomage

September 22nd, 2009 Dallas No comments

Grant and I are working on rewriting a game he created several years ago called “Grant’s Ants” (he later renamed it to “Battleopolis”).  Originally it was a clone of a game called Ants by Miroslav Nemecek (which was itself a clone of Arcomage).  Grant was mainly interested in the rewrite since he wanted to learn C#, and I’m in it because I found the game strangely addictive.

You can find Grant’s original version on his blog.

You can download Miroslav’s version at Gosfish Games or I have it hosted here.

Categories: Grant's Ants Tags: , ,

Letter to Tom Adams, CEO of Rosetta Stone

September 21st, 2009 Dallas 31 comments

Below I’ve posted an e-mail I sent to Tom Adams (the CEO of Rosetta Stone) a few weeks ago regarding my very disappointing experiences with his product, namely the entire deactivation process they have implemented.   He never responded, so I thought I’d post it here and see what others thought.

If you too want to let Mr. Adams know what you think, send him an e-mail at tadams@rosettastone.com.  I’m sure he would be very happy to hear from you (don’t hold your breath)!

Read more…

Categories: General Tags: , ,

Double Smite!

September 18th, 2009 Dallas 3 comments

My buddy Steven over at the Mac Fam blog is getting hitched this weekend, so naturally we had a bachelor’s party to celebrate.  I’ve learned a few things:

  • I like Irish Car Bombs
  • Three of them is too many
  • I found no truth to the adage, “Beer before liqour…”
  • Despite what it may seem at the time, it’s always better to be the DD in the end

Congrats, Steve – I wish you the best.

The Last Seven Minutes

September 9th, 2009 Dallas 1 comment

My friend Grant (whose blog is linked at the bottom) has been working pretty hard developing a music review site he’s named, “The Last Seven Minutes.”  It was a pretty ambitious goal for his first real web development project, but he’s managed to pull it off.  Check it out at http://grantrose.org/reviews.php.

Server is Back Online!

September 9th, 2009 Dallas No comments

It’s been a rough few weeks for the blog server.  The router I had been using in the apartment was among the most unreliable I have ever seen.  It needed to be reset daily, sometimes several times a day, port forwarding only worked when the planets aligned just so, and most of the time it completely ignored the static IP rules I set.  I finally swapped it out with another router I had sitting around and it looks like everything is resolved, including the issue where I had to take the server offline to update from home.  Sweet!

I’ve got a couple of posts that are still in the draft stage that I hope to have up soon now that I have more reliable access to the server.

Categories: General Tags:

We made it!

August 13th, 2009 Dallas 2 comments

We finally made it! Finally!

We are at the hotel now getting cleaned up and ready to visit Cierra’s new place. Everyone is supposed to be meeting at 5pm to finalize everything. After that Cierra, Autum + BF, and I are going out to dinner.

Last screenshot to complete the set:

Virginia Drivers: Illinois drivers make you all look like heathens of the roadway. I’ve never seen such considerate motorists before.

Categories: General Tags: , ,

Welcome to Indiana!

August 13th, 2009 Dallas No comments

Well sort of; we’re still about 15 minutes out, but I’m starting to crash so I’m hopping in the passenger seat for a nap. Goodnight.

Scratch that – we’re officially in Indiana. Shooting stars are still going strong. Three states down, two to go!

Categories: General Tags: ,

Welcome to Ohio!

August 12th, 2009 Dallas No comments

There appears to be nothing of note here.

Categories: General Tags: ,