SRT Solutions

Blogs

Browse by Tags

  • Project Eurler #12

    I see that Bill did Euler #11 earlier this week so I thought I'd tackle #12 . The first thing I wanted to do was write a routine to generate a triangle number. As we've seen throughout this series , LINQ can come in very handy: static int TriangleOf( int number) { return Enumerable.Range(1, number...
    Posted to Patrick Steele (Weblog) by Anonymous on Sat, Oct 4 2008
  • Euler Problem 10

    Patrick posted his solution earlier this week. I figure it was time to add mine. Also, Octavio Hernandez pointed out in the comments to problem 8 that he had discussed similar code constructs in his blog a while back. Problem 10 asks for the sum of all primes less than 2 million. It's also one line...
    Posted to Bill Blogs in C# (Weblog) by wwagner on Sun, Aug 31 2008
  • Euler Problem 9

    I was going to wait a bit to post this, but Patrick Steele posted his solution , so I figured I should post mine. Patrick took the straight out brute force approach. I decided to think a bit differently and use the some LINQ code to generate my answer. The problem is to find the only Pythagorean triplet...
    Posted to Bill Blogs in C# (Weblog) by wwagner on Thu, Aug 28 2008
  • Euler Problem 7

    Yes, it's true that I've been very lax in working on these problems. It's been a combination of the day job, finishing all the editing tasks on "More Effective C#", and actually trying to keep the personal life intact. The 7th problem is quite straightforward: find the 10,001st...
    Posted to Bill Blogs in C# (Weblog) by wwagner on Thu, Aug 14 2008
  • Project Euler Problem Number 3

    Project Euler problem 3 reads as follows: The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? There are no special Python features here that really require explaining. The logic is also straightforward: find the smallest prime that divides evenly...
    Posted to Darrell Hawley Blog (Weblog) by dhawley on Fri, May 2 2008
  • euler problem #5

    What is the smallest number that is evenly divisible by all of the numbers from 1 to 20? ---- To solve this problem easily, we need to remember that the smallest number that is evenly divisible by two numbers is their least common multiple. Armed with this knowledge (and the fact that ruby already has...
    Posted to Lazy Evaluation (Weblog) by mfedner on Thu, May 1 2008
  • Project Euler Problem 2

    Problem number 2 reads "Find the sum of all the even-valued terms in the Fibonacci sequence which do not exceed four million." The resolution to this problem is not quite as simple as the previous one, but it's not far off. def fib(maxFibNumber): a, b = 0, 1 while a < maxFibNumber: if...
    Posted to Darrell Hawley Blog (Weblog) by dhawley on Sat, Apr 12 2008
  • Project Euler problem 6

    Euler Problem six asks you to find the difference between the sum of squares and the square of the sum for the natural numbers 1 through 100. I took the easy route, and made a brute force implementation in C#. There are a couple new bits of LINQ syntax here. This query creates two different anonymous...
    Posted to Bill Blogs in C# (Weblog) by wwagner on Fri, Apr 11 2008
  • Euler Problem 4

    Find the largest palindrome made from the product of two 3-digit numbers. ----- First, I defined a palindrome recursively: a number is one if its first and last digits are the same, and if the inside is also a palindrome. def palindrome?(digitArr) if digitArr.empty? true elsif digitArr.length == 1 true...
    Posted to Lazy Evaluation (Weblog) by mfedner on Tue, Apr 8 2008
  • Euler Problem 3

    What is the largest prime factor of the number 600851475143 ? ----- I wrote this piece of disgusting, un-Rubylike Ruby to get the answer by creating a list of a number's prime factors: def factor(composite) i=1 flag=false primefactors =[] while (i < composite) i=i+1 primefactors.each{|p| flag...
    Posted to Lazy Evaluation (Weblog) by mfedner on Tue, Apr 8 2008

In our last colurm, we wrote about how technical mentors can benefit companies ( Ann Arbor Business Review, May 22, 2008 ). In this installment, we're...