Posts

Why I don't want to have children

The human species is consuming resources and producing waste. Ultimately, this will cause a crash. The time until this crash is a function of the number of human beings that have lived. I do not want to accelerate the crash, therefore I will not procreate.

Solving equations by rule-based artificial intelligence

This probably isn't new, but it is an idea I've had now. When I was younger I wondered why computer programs can compute assignments but are unable to solve equations in which the variable that was to be assigned was not explicit. In fact it is quite easy to program a computer so that it is able to solve equations. The easiest way is to use a binary tree to represent an equation. A binary tree has an operator as its root, e.g. equality, and the operands as its right and left children. It is basically similar to a linked list and can be represented in prefix notation. For instance, the equation "(3 x + 5) * 4 = 44" would be "= * + * 3 x 5 4 44" in prefix notation. Now the computer only needs to know some rules such as that "= + a b c" is equal to "= - c b a". Then the computer can systematically use these rules to consecutively move the variable (e.g. x) to a higher position inside the binary tree than where it initially is, until it reach

Acey Ducey in Kotlin

While doing research for my job I bumped into the site https://github.com/coding-horror/basic-computer-games where old computer games written in Basic are ported to modern languages. I am very fond of this project and I've already contributed a port myself, namely a port of Acey Ducey to Kotlin.

Project Euler #3

A colleague of mine has suggested solving Project Euler #3 as a challenge. I noticed that his code was working fine but very inefficient. In fact the specification of this task is misleading because it suggests that it is necessary to check if a solution is prime. But it is possible to formulate the solution without checking for primality. Here is my implementation in Kotlin. fun euler3(n: Long, i: Long = 2): Long =     if (i >= n) n     else if (n % i == 0L) euler3(n / i, i)     else euler3(n, i + 1) fun main(args: Array<String>) {     var numcur = euler3(600851475143)     print("$numcur") } The trick is to quit the loop when i exceeds n.

Mein Weltbild

Es gibt nicht nur die physische Welt, die wir mit unseren fünf Sinnen wahrnehmen können, sondern auch eine Welt der Ideen. Alles Denkbare existiert in dieser Welt. Der kreative Prozess besteht darin, Ideen in der physischen Welt umzusetzen.

Program to calculate number of paths through a rectangular grid

A user at StackOverflow has problems to come up with a recursive function that computes the number of paths through a square grid of a given size. I've generalized this problem for rectangular grids and found a very elegant solution (Kotlin): fun board(x: Int, y: Int): Int =     if (x <= 1 || y <= 1) 1     else board(x - 1, y) + board(x, y - 1) fun main(args: Array<String>) {     var numcur = board(10, 10)     print("$numcur") } If we calculate this for x = y = 1, ..., 10, we get the values 1, 2, 6, 20, 70, 252, 924, 3432, 12870, 48620. A Google search shows that this sequence is known as Central binomial coefficients: binomial(2*n,n) = (2*n)!/(n!)^2. As a comment of a user of the OEIS database shows it is indeed the solution to our problem: The number of direct routes from my home to Granny's when Granny lives n blocks south and n blocks east of my home in Grid City. To obtain a direct route, from the 2n blocks, choose n blocks on which one travels south.

Mein politisches Leben

Ich habe bereits als Jugendlicher mit liberalen Ideen sympathisiert. Parteipolitisch war ich zuerst Mitglied der Österreichischen Medizinerunion und einer kurzen Zeit lang der Piratenpartei Österreichs, ehe ich mich entschloss, den Jungen Liberalen beizutreten, um endlich bei einer Partei zu sein, mit der ich mich voll identifizieren konnte. Später war ich, als logische Konsequenz dieser Entwicklung, Mitglied von NEOS. Vor kurzem bin ich nun aus NEOS ausgetreten, um fortan als parteipolitisch Unabhängiger das politische Geschehen in Österreich und der Welt zu beobachten. Der Grund meines Austritts war einfach, dass ich nicht mehr vorhabe, mich um ein politisches Amt zu bewerben. Den liberalen Ideen bleibe ich aber selbstverständlich treu. Seit ich in der Computer-Demoszene aktiv gewesen bin, haben mich nichtstaatliche Organisationsformen fasziniert. Ich glaube, dass einzelne Bürger durchaus in der Lage sind, etwas aufzubauen, ohne Hilfe vom Staat zu benötigen. In diesem Sinne werde ich