January 2011 Blog Posts
Onwards, to Project Euler problem #3. The problem is defined as below: The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? So, basically, we need to find out which factors make up a certain number. The easiest way to do this is simply by trial division. A very naïve implementation would be something like this: function Get-PrimeFactors ([long]$number)
{
while ($number -gt 1)
{
for($i...
The first few Project Euler problems are actually pretty trivial to brute force, but sometimes they have a smart solution. All in all, coming up with a semi-smart title for the post is usually harder than the problem itself. But I don’t want to leave anything out, so I’ll just continue on with problem #2: 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, ......
I am not at all sure how far I will get with this, but I am going to try. So far I have solved the first 7 problems from Project Euler, using PowerShell. I will, whenever I solve a problem, take my time to write about my solution and what I’ve learned about math and PowerShell. It should be a good read for anyone not particularly a wizard at math, because I don’t have a math major either. Everything I write here should be in reasonably understandable terms, because I need to understand it too! Either way, let’s start...
In the past week I’ve been trying to solve Project Euler projects using PowerShell. So far so good, most problems are quite doable (although sometimes a bit slow). I’m going to write at least three posts about this (I have two drafts already), for which I will need some way to properly format mathematical equations. For this, I installed MathJax (http://www.mathjax.org/), which converts formulae in LaTeX of MathML format into the proper representation. This post is more or less me trying out a few options, and showing off the pretty math. Sum of all terms of f(x2)...
Here’s a scenario: you are writing install scripts which configure your IIS instance, or a deployment script that deploys an application which depends on a certain .NET version. Ideally, you’d want to detect the absence of your required framework and have an option to install said framework. Here’s a start on how to get this done using PowerShell. First off, we need to find out how to detect which frameworks are installed. Luckily, StackOverflow came to the rescue. THIS question, and in particular the first answer, details on how to detect which frameworks are installed, by querying the registry....
When I have to use SVN for version control (I am more of a Git fanboy nowadays), I use my tags to identify releases. And if we take a look at the Subversion red bookI’m not the only one: Another common version control concept is a tag. A tag is just a “snapshot” of a project in time. In Subversion, this idea already seems to be everywhere. Each repository revision is exactly that—a snapshot of the filesystem after each commit. However, people often want to give more human-friendly names to tags, such as...
A few days ago I decided to chase the twitter name I really want, especially with my domain name (and coincidentally my business name) in mind. I’ve been checking the http://www.twitter.com/smoothfriction page regularly, to see if there was any action. Nothing happened: no tweets whatsoever, hardly any followers, just an idle account. An account I WANTED! I decided to hit google, to find out my options. At first, I was quite optimistic. I found a blog post by ‘Zee’ which explains which steps I should take: Email username@twitter.com with the following information: ...