1
0

replace mathblog.dk links with waybackmachine
All checks were successful
Build Docker and Deploy / Build Docker (push) Successful in 45s
Build Docker and Deploy / Deploy to Server (push) Successful in 19s

This commit is contained in:
Mike Schwörer 2025-03-30 23:43:38 +02:00
parent be1c44ffc6
commit ba579dab23
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
8 changed files with 9 additions and 9 deletions

View File

@ -1 +1 @@
Here I was desperately in need of an efficient algorithm. So I copied [this](http://www.mathblog.dk/triangle-number-with-more-than-500-divisors/) one from mathblog.dk and translated it into befunge. And I have to say it's amazingly fast.
Here I was desperately in need of an efficient algorithm. So I copied [this](https://web.archive.org/web/20150314051848/http://www.mathblog.dk/triangle-number-with-more-than-500-divisors/) one from mathblog.dk and translated it into befunge. And I have to say it's amazingly fast.

View File

@ -1,4 +1,4 @@
This is effectively an optimized implementation of [this algorithm](http://www.mathblog.dk/project-euler-51-eight-prime-family/).
This is effectively an optimized implementation of [this algorithm](https://web.archive.org/web/20150307042855/http://www.mathblog.dk/project-euler-51-eight-prime-family/).
You can see the ten patterns on the left side and beside them the area were we build our numbers.
So what we do is iterate through the numbers from `100` to `1 000`, through the ten patterns and through the digits `0`, `1` and `2`.

View File

@ -1,4 +1,4 @@
It's obvious that the bottleneck of this program is the primality test.
The numbers become here too big to create a sieve and "normal" prime testing takes too long.
So we use the [Miller-Rabin primality test](https://en.wikipedia.org/wiki/Miller-Rabin_primality_test) that I implemented a while ago (thank [mathblog.dk](http://www.mathblog.dk)).
So we use the [Miller-Rabin primality test](https://en.wikipedia.org/wiki/Miller-Rabin_primality_test) that I implemented a while ago (thanks [mathblog.dk](https://web.archive.org/web/20150314052138/http://www.mathblog.dk/project-euler-58-primes-diagonals-spiral/)).
The rest is just enumerating all the diagonals until `primes*10<all`

View File

@ -2,12 +2,12 @@ Wow, so this is now officially my biggest (in terms of file size) befunge progra
The file has around ten megabyte. And probably also in terms of unique variables (26 variables plus two 2D-arrays)
The problem was also not that *befunge-compatible*.
My solution is pretty similar with the one from [MathBlog](http://www.mathblog.dk/project-euler-60-primes-concatenate/).
My solution is pretty similar with the one from [MathBlog](https://web.archive.org/web/20150407005005/http://www.mathblog.dk/project-euler-60-primes-concatenate/).
We generate primes from `1` to `3300` and save verified pairs in an Hashmap.
And when I say Hashmap I mean an *fucking* `3000x3000` array where every possible pair has an field (yay for befunge).
I had to use quite a few codesnippets from older project:
My standard [sieve of eratosthenes](https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes), an implementation of the [Miller-Rabin primality test](https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test) and method to [concatenate two numbers](http://www.mathblog.dk/files/euler/Problem60.cs).
My standard [sieve of eratosthenes](https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes), an implementation of the [Miller-Rabin primality test](https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test) and method to [concatenate two numbers](https://web.archive.org/web/20150103211935/http://www.mathblog.dk/files/euler/Problem60.cs).
In the end is to say that in befunge the program size is normally an good indicator for the runtime (not really, but its kinda correct for all my programs).
So as you probably guessed this program takes a pretty loooooong time to complete.

View File

@ -1,3 +1,3 @@
I had a really complicated solution where I tried to generate an Phi Sieve and had to work around a lot of corner cases.
Then I looked at [this](http://www.mathblog.dk/project-euler-69-find-the-value-of-n-%E2%89%A4-1000000-for-which-n%CF%86n-is-a-maximum/) solution and - well - it's faster and simpler than mine.
Then I looked at [this](https://web.archive.org/web/20150326003453/http://www.mathblog.dk/project-euler-69-find-the-value-of-n-%E2%89%A4-1000000-for-which-n%CF%86n-is-a-maximum/) solution and - well - it's faster and simpler than mine.
So I translated it to befunge.

View File

@ -1,4 +1,4 @@
The solution is practically identical to the one from [Mathblog](http://www.mathblog.dk/project-euler-70-investigate-values-of-n-for-which-%CF%86n-is-a-permutation-of-n/).
The solution is practically identical to the one from [Mathblog](https://web.archive.org/web/20150326005645/http://www.mathblog.dk/project-euler-70-investigate-values-of-n-for-which-%CF%86n-is-a-permutation-of-n/).
But Kristian explains it much better than I :).
We use our trustworthy [Sieve of Eratosthenes](https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes) snippet and the *GetCombinatoricHash*-function from problem-62

View File

@ -1,4 +1,4 @@
Again the algorithm is from [MathBlog](http://www.mathblog.dk/project-euler-78-coin-piles/).
Again the algorithm is from [MathBlog](https://web.archive.org/web/20150326121651/http://www.mathblog.dk/project-euler-78-coin-piles/).
I can't really say that I understand the algorithm fully (and the MathBlog guy says he neither).
But for the best explanation you better read his article.

View File

@ -1,5 +1,5 @@
Nothing much to say about this one, we play a bit with the triangle formulas until we reach something that looks like a [Pell equation](https://en.wikipedia.org/wiki/Pell%27s_equation).
My approach is basically the same as the one on [mathblog.dk](http://www.mathblog.dk/project-euler-94-almost-equilateral-triangles/), but he explains it better.
My approach is basically the same as the one on [mathblog.dk](https://web.archive.org/web/20150420081602/http://www.mathblog.dk/project-euler-94-almost-equilateral-triangles/), but he explains it better.
(And I improved my approach a bit after I read his article, his math skills are pretty good :D).
The code is in a way interesting because it only has a single conditional operator.