2018-12-01, post № 207
Haskell, mathematics, programming, #diagonalization
Let be the two-dimensional complex vector space of sequences adhering to the Fibonacci recurrence relation with basis .
Let furthermore be the sequence shift endomorphism represented by the transformation matrix
By iteratively applying the sequence shift a closed-form solution for the standard Fibonacci sequence follows.
2018-11-03, post № 206
C, mathematics, programming, #integer, #list, #primes, #representation
Since ancient times humanity knew that there are infinitely many primes — though countable, writing a complete list of every prime is impossible if one intends to finish.
However, in practice one often only considers a minute subset of the naturals to work with and think about. When writing low-level languages like C, one is nearly forced to forget about almost every natural number — the data type
u_int_32, for example, is only capable of representing .
Therefore, it is possible to produce a complete list of every prime representable in thirty-two bits using standard bit pattern interpretation — the entirety of the first 𝟤𝟢𝟥 𝟤𝟪𝟢 𝟤𝟤𝟣 primes.
Generating said list took about two minutes on a 4GHz Intel Core i7 using an elementary sieve approach written in C compiled with
All primes are stored in little-endian format and packed densely together, requiring four bytes each.
Using the resulting file, one can quickly index the primes, for example (using zero-based indexing). Since each prime is stored using four bytes, the prime’s index is scaled by a factor of four, resulting in its byte index.
dd status=none ibs=1 count=4 if=primes.bin skip=40000000 | xxd
00000000: b3cd b10a ....
Source code: prime-intirety.c
Prime list (gzipped and split): prime-intirety_primes.bin.gz.parts
2018-10-31, post № 205
art, haiku, poetry, #bat
Tiny droplet falls.
A bat’s screech echoes through the cave.
Flowstone grew again.
Jonathan Frech's blog; built 2021/04/16 21:21:49 CEST