Home

23 comments

susam14 days ago
I’d like to share some little demos here.<p>Bitwise XOR modulo T: <a href="https:&#x2F;&#x2F;susam.net&#x2F;fxyt.html#XYxTN1srN255pTN1sqD" rel="nofollow">https:&#x2F;&#x2F;susam.net&#x2F;fxyt.html#XYxTN1srN255pTN1sqD</a><p>Bitwise AND modulo T: <a href="https:&#x2F;&#x2F;susam.net&#x2F;fxyt.html#XYaTN1srN255pTN1sqN0" rel="nofollow">https:&#x2F;&#x2F;susam.net&#x2F;fxyt.html#XYaTN1srN255pTN1sqN0</a><p>Bitwise OR modulo T: <a href="https:&#x2F;&#x2F;susam.net&#x2F;fxyt.html#XYoTN1srN255pTN1sqDN0S" rel="nofollow">https:&#x2F;&#x2F;susam.net&#x2F;fxyt.html#XYoTN1srN255pTN1sqDN0S</a><p>Where T is the time coordinate. Origin for X, Y coordinates is at the bottom left corner of the canvas.<p>You can pause the animation anytime by clicking the ‘■’ button and then step through the T coordinate using the ‘«’ and ‘»’ buttons.
评论 #43951751 未加载
评论 #43950438 未加载
评论 #43955675 未加载
评论 #43954062 未加载
评论 #43950225 未加载
gjm1114 days ago
Here&#x27;s a possibly-too-highbrow explanation to complement the nice simple one in the OP.<p>&quot;As everyone knows&quot;, you get a Sierpinski triangle by taking the entries in Pascal&#x27;s triangle mod 2. That is, taking <i>binomial coefficients</i> mod 2.<p>Now, here&#x27;s a cute theorem about binomial coefficients and prime numbers: for any prime p, the number of powers of p dividing (n choose r) equals the number of <i>carries</i> when you write r and n-r in base p and add them up.<p>For instance, (16 choose 8) is a multiple of 9 but not of 27. 8 in base 3 is 22; when you add 22+22 in base 3, you have carries out of the units and threes digits.<p>OK. So, now, suppose you look at (x+y choose x) mod 2. This will be 1 exactly when <i>no</i> 2s divide it; i.e., when <i>no</i> carries occur when adding x and y in binary; i.e., when x and y never have 1-bits in the same place; i.e., when x AND y (bitwise) is zero.<p>And that&#x27;s exactly what OP found!
评论 #43954620 未加载
评论 #43952114 未加载
评论 #43951307 未加载
dvt14 days ago
Just a heads up, all (binary?) logical operators produce fractals. This is pretty well-known[1].<p>[1] <a href="https:&#x2F;&#x2F;icefractal.com&#x2F;articles&#x2F;bitwise-fractals&#x2F;" rel="nofollow">https:&#x2F;&#x2F;icefractal.com&#x2F;articles&#x2F;bitwise-fractals&#x2F;</a>
评论 #43950265 未加载
评论 #43953861 未加载
评论 #43961011 未加载
评论 #43952641 未加载
modeless14 days ago
Try this one liner pasted into a Unix shell:<p><pre><code> cc -w -xc -std=c89 -&lt;&lt;&lt;&#x27;main(c){int r;for(r=32;r;)printf(++c&gt;31?c=!r--,&quot;\n&quot;:c&lt;r?&quot; &quot;:~c&amp;r?&quot; `&quot;:&quot; #&quot;);}&#x27;&amp;&amp;.&#x2F;a.* </code></pre> It used to be cooler back when compilers supported weird K&amp;R style C by default. I got it under 100 characters back then, and the C part was just 73 characters. This version is a bit longer but works with modern clang. The 73-character K&amp;R C version that you can still compile today with GCC is:<p><pre><code> main(c,r){for(r=32;r;)printf(++c&gt;31?c=!r--,&quot;\n&quot;:c&lt;r?&quot; &quot;:~c&amp;r?&quot; `&quot;:&quot; #&quot;);}</code></pre>
评论 #43950379 未加载
jcul14 days ago
I can&#x27;t dismiss the cookie popup on this page. After rejecting or accepting cookies it reloads and reappears.<p>Apologies for a comment not related to the content, but it makes it difficult to read the article on mobile.
评论 #43952593 未加载
评论 #43954840 未加载
评论 #43949707 未加载
评论 #43949506 未加载
评论 #43951796 未加载
marvinborner14 days ago
Very cool! This basically encodes a quad-tree of bits where every except one quadrant of each subquadrant recurses on the parent quad-tree.<p>The corresponding equivalent of functional programming would be Church bits in a functional quad-tree encoding \s.(s TL TR BL BR). Then, the Sierpinski triangle can be written as (Y \fs.(s f f f #f)), where #f is the Church bit \tf.f!<p>Rendering proof: <a href="https:&#x2F;&#x2F;lambda-screen.marvinborner.de&#x2F;?term=ERoc0CrbYIA%3D" rel="nofollow">https:&#x2F;&#x2F;lambda-screen.marvinborner.de&#x2F;?term=ERoc0CrbYIA%3D</a>
kragen14 days ago
The 31-byte demo &quot;Klappquadrat&quot; by T$ is based on this phenomenon; I wrote a page about how it works a few years ago, including a working Python2 reimplementation with Numpy: <a href="http:&#x2F;&#x2F;canonical.org&#x2F;~kragen&#x2F;demo&#x2F;klappquadrat.html" rel="nofollow">http:&#x2F;&#x2F;canonical.org&#x2F;~kragen&#x2F;demo&#x2F;klappquadrat.html</a><p>I should probably update that page to explain how to use objdump <i>correctly</i> to disassemble MS-DOG .COM files.<p>If you like making fractal patterns with bitwise arithmetic, you&#x27;ll probably love <a href="http:&#x2F;&#x2F;canonical.org&#x2F;~kragen&#x2F;sw&#x2F;dev3&#x2F;trama" rel="nofollow">http:&#x2F;&#x2F;canonical.org&#x2F;~kragen&#x2F;sw&#x2F;dev3&#x2F;trama</a>. Especially if you like stack machines too. The page is entirely in Spanish (except for an epilepsy safety warning) but I suspect that&#x27;s unlikely to be a problem in practice.
评论 #43950201 未加载
tpoacher13 days ago
I reached a similar result when researching all possible &quot;binary subpixel&quot; configurations that would give a pixel its fuzzy value. Arranging the configurations in ascending order row-wise for one pixel and column-wise for the other, performing an intersection between the two pixels, and plotting against their resulting fuzzy value results in a sierpinski triangle.<p>(if interested, see fig 4.3, page 126 of my thesis, here: <a href="https:&#x2F;&#x2F;ora.ox.ac.uk&#x2F;objects&#x2F;uuid:dc352697-c804-4257-8aec-088ea28806c5" rel="nofollow">https:&#x2F;&#x2F;ora.ox.ac.uk&#x2F;objects&#x2F;uuid:dc352697-c804-4257-8aec-08...</a>)<p>Cool stuff. Especially the bottom right panel, you might not have expected that kind of symmetry in the intersection when looking at the individual components.
anyfoo14 days ago
Ah. Is that why LFSRs (linear feedback shift registers) and specifically PRBS generators (pseudo-random binary sequences) produce Sierpinski triangles as well?<p>PRBS sequences are well-known, well-used &quot;pseudo-random&quot; sequences that are, for example, used to (non-cryptographically!) scramble data links, or to just test them (Bit Error Rate).<p>I made my own PRBS generator, and was surprised that visualizing its output, it was full of Sierpinski triangles of various sizes.<p>Even fully knowing and honoring that they have no cryptographic properties, it didn&#x27;t feel very &quot;pseudo-random&quot; to me.
fiforpg14 days ago
&gt; the magic is the positional numeral system<p>— of course. In the same way the (standard) Cantor set consists of precisely those numbers from the interval [0,1] that can be represented using only 0 and 2 in their ternary expansion (repeated 2 is allowed, as in 1 = 0.2222...). If self-similar fractals can be conveniently represented in positional number systems, it is because the latter are self-similar.
pacaro14 days ago
There are so many ways to produce sierpinski gaskets.<p>It you specify n points and the pick a new point at random, then iteratively randomly select (uniformly) one of the original n points and move the next point to the mid point of the current point and the selected point. Coloring those points generates a sierpinski triangle or tetrahedron or whatever the n-1 dimensional triangle is called
评论 #43951836 未加载
评论 #43953842 未加载
zabzonk14 days ago
I draw these with paper and pen when I am extremely bored in meetings.
msephton14 days ago
I first saw these sorts of bitwise logic patterns at <a href="https:&#x2F;&#x2F;twitter.com&#x2F;aemkei&#x2F;status&#x2F;1378106731386040322" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;aemkei&#x2F;status&#x2F;1378106731386040322</a> (2021)
peterburkimsher14 days ago
Wolfram did a lot of research into cellular automata, and the Sierpinski Triangle kept showing up there too:<p><a href="https:&#x2F;&#x2F;www.wolframscience.com&#x2F;nks&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.wolframscience.com&#x2F;nks&#x2F;</a>
评论 #43949699 未加载
zX41ZdbW14 days ago
Sierpinski also sounds nice in music. Examples here: <a href="https:&#x2F;&#x2F;github.com&#x2F;ClickHouse&#x2F;NoiSQL">https:&#x2F;&#x2F;github.com&#x2F;ClickHouse&#x2F;NoiSQL</a>
tikili14 days ago
Munching squares: <a href="https:&#x2F;&#x2F;tiki.li&#x2F;show&#x2F;#cod=VYxLCoAwDET3PcWsFWql4s7D1Fo&#x2F;oBZqkfb2JlIEk0WSNzO5LAa0SqFB34nZByQEcy5O8Q2AUf4jqpVS4xbNOfFIbyyj1&#x2F;xGF4&#x2F;1uw+arNQFHf525KxwWbLzKEJwNjKsoWT7LSxKIYV4AA==" rel="nofollow">https:&#x2F;&#x2F;tiki.li&#x2F;show&#x2F;#cod=VYxLCoAwDET3PcWsFWql4s7D1Fo&#x2F;oBZqkf...</a>
ChuckMcM14 days ago
Y&#x27;all would really like <a href="https:&#x2F;&#x2F;www.gathering4gardner.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.gathering4gardner.org&#x2F;</a> :-)<p>I tend to like lcamtuf&#x27;s Electronics entries a bit better (I&#x27;m an EE after all) but I find he has a great way of explaining things.
lenerdenator14 days ago
It&#x27;s more likely than you think.
tomrod14 days ago
I prefer mine au naturale 3-adic.<p><a href="https:&#x2F;&#x2F;m.youtube.com&#x2F;watch?v=tRaq4aYPzCc" rel="nofollow">https:&#x2F;&#x2F;m.youtube.com&#x2F;watch?v=tRaq4aYPzCc</a><p>Just kidding. This was a fun read.
jesuslop14 days ago
You get those also doing a Pascal triangle mod 2, so a xor. Is a zoom-out fractal as oposed to Mandelbrot set.
评论 #43949559 未加载
MaxGripe14 days ago
Sierpinski pirated it from Razor 1911 :)
immibis14 days ago
basically, whenever a shape contains 3 connected couples of itself, you get a deformed Sierpinski triangle.
gitroom14 days ago
been down the bitwise fractal rabbit hole more times than i can count and honestly, i never get tired of these patterns - you think people start seeing shapes like this everywhere after a while or is that just me