How to compute the value of the mathematical constant e using recursion in the Raku programming language.

## Computing e in Raku

How to compute the value of the mathematical constant e using recursion in the Raku programming language.

Skip to content
# Category: Algorithms

## Computing e in Raku

How to compute the value of the mathematical constant e using recursion in the Raku programming language.

How to compute the value of the mathematical constant e using recursion in the Raku programming language.

## Implementing the Ackermann function in Raku

## Collatz Conjecture in Raku

An interesting task offered on Week 54 of the Perl Weekly Challenge: Print the Collatz Conjecture for the given integer number. The conjecture is that for any starting number, the sequence ends with 1.

## Practicing Raku challenges

## 💡 107. Odd-even sort in Perl 6

## 💡 106. Gnome sort in Perl 6

## 💡 105. Pancake sort in Perl 6

## 💡 104. Stooge sort in Perl 6

## 💡 103. Merge sort in Perl 6

## 💡 102. Insertion sort in Perl 6

## 💡 101. Quick sort in Perl 6

## 💡 100. Bubble sort in Perl 6

Science, Programming, Electronics, Languages

This is the Task 1 from the Perl Weekly Challenge Week 17. You have to implement the so-called Ackermann function.

This is an interesting function that is defined kind of recursively but actually this is not a recursion, as the recurrent formula is using the function as an argument of itself.

This is the Task 1 from the Perl Weekly Challenge Week 17. You have to implement the so-called Ackermann function.

This is an interesting function that is defined kind of recursively but actually this is not a recursion, as the recurrent formula is using the function as an argument of itself.

An interesting task offered on Week 54 of the Perl Weekly Challenge: Print the Collatz Conjecture for the given integer number. The conjecture is that for any starting number, the sequence ends with 1.

A few Raku challenges solutions: printing arrays, generating Leonardo numbers, converting to octals.

A few Raku challenges solutions: printing arrays, generating Leonardo numbers, converting to octals.

In the Odd-Even sort, or Brick sort, you take every second element and swap it with the next one if they are not sorted. Then you take the same elements and swap it with the previous element if they are not ordered. You continue until you are done. You can formulate the algorithm a bit … Continue reading “💡 107. Odd-even sort in Perl 6”

Our today’s topic is the Gnome sort, which is also referred to as Stupid sort. To sort an array using this method, you scan the data from left to right and check the two adjacent items to see if they are ordered properly. If they are, you go forward. If not, you swap the elements … Continue reading “💡 106. Gnome sort in Perl 6”

The Pancake sort is an interesting method of sorting data, as unlike more traditional sorting algorithms, it operates with piles of data on each step. You have to imagine data as a pile of pancakes, the values corresponding to the size of pancakes. The only allowed operation is flipping a pile of ‘pancakes.’ It can … Continue reading “💡 105. Pancake sort in Perl 6”

Have you ever heard of the Stooge sort algorithm? If not, it is quite interesting to learn it. The idea is clear, while you maybe need some time to see if it really works. So, take a list of numbers and swap the first and the last elements if they are not sorted properly (that … Continue reading “💡 104. Stooge sort in Perl 6”

Welcome to another sorting episode, this time we’ll talk about Merge sort in Perl 6. In Merge sort, you first split the data into halves until the pieces become atomic (in the original meaning of the word), that is either each piece contains a single element, or, after the current split, the second part contains … Continue reading “💡 103. Merge sort in Perl 6”

Today, we are investigating the Insertion sort algorithm and its possible implementation in Perl 6. The algorithm’s complexity is O(n2), but it is a good candidate to practice some Perl 6. The idea is simple. You find the minimum value in the array and put it to the first position. Then you scan the data … Continue reading “💡 102. Insertion sort in Perl 6”

Today, let’s look at another, and presumably the most well known method of sorting data, Quick sort. The algorithm requires you to select the so-called pivot, one of the element from the data, and split the rest in two parts: the elements less than the pivot, and the elements more or equals to the pivot. … Continue reading “💡 101. Quick sort in Perl 6”

Hey everyone, let’s implement some algorithms in Perl 6. The first one will be the classical Bubble sort. In essence, you scan the data from left to right and swap the two adjacent items if they are not ordered properly yet. Repeat until the whole data list is ordered. Here’s the initial straightforward implementation: sub … Continue reading “💡 100. Bubble sort in Perl 6”