Project Euler 24
Project Euler problem number #24 deals with permutations in lexicographical order. A non-brute force approach involves a mixed base number system based on factorials.
Project Euler problem number #24 deals with permutations in lexicographical order. A non-brute force approach involves a mixed base number system based on factorials.
To create the rotations I make a “detour” by converting the number into a string and then performing the rotations on the string.
I have never completely understood why Visual Studio had to start another (graphical) utility in order to create GUIDs. I’m all for the UNIX kind of small (text based) utilities than can be combined. Furthermore, this utility creates GUID in formats that are useful to C++ programmers. Why have they not used the built in Macro system?
For a long time I had a strange problem on my workstation. Some programs crashed before showing a window. For example, I was unable to run programs in the standard Visual Studio projects folder under my documents and settings. But they ran fine when moved somewhere else. I suspected some permission problem but I could not find and thus fix it.
The familiar for loop featured in most if not all impertive langagues is not part of most functional languages if any because it has the mutable loop index. The standard way of looping in F# is to use recursion.
A solution to Euler 48
My previous task switcher application had a serious performance problem as it was programmed in .NET. In order to start the small utility you had to load up the CLR and a bunch of assemblies (dlls). If you are a .NET developer it might not be that big a problem as most of the code was already loaded up. However, for general use it was not the best option.
F# has a nice syntax for creating sequences where elements are created on demand.
What is the average distance between two points on a circle?
We define the distance as going through the circle as going around the circle reduces the problem to the problem of average distance on a line, see Average Distance on a Line.
Problems 18 and 67 differs in their size, where problem 67 is so large that a (naive) brute force algorithm would not end within reasonable time. A simple algorithm shows it self if we goes from the bottom up. The problem formulation displays the numbers such that one looks at the numbers from the top going down.