Almost Infinite Sequences in F#
F# has a nice syntax for creating sequences where elements are created on demand.
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.
F# has a lot of functionality for manipulation of lists. Here is my first attempt at the solution in F#.
To solve problem #23 I apply simple brute force and we get to play a little with F# sets.
I prefer to use the keyboard whenever possible. I have a two monitor setup and found myself moving windows from one monitor to the other using the mouse. However, using AutoHotKey I was able to do this by keyboard. Also I wanted to swithc easily to a particular window using the keaboard.
Update: The functionality has now been integrated into Windows 7.
As warm-up to the question of average distance between two points on a circle I’ll start out finding the average distance between two points on a line.
The problem is to deduce how the temperature changes (we will call this a temperature profile) at one place from measurements at another place. You will need a very old browsser for it to work.