top | item 39689503

(no title)

sflanker | 1 year ago

If somebody can explain why bitwise ands generate serpinski triangles I would sure like to know.

(y * 4 & x *4) % (frameCount / 10 % 300)

discuss

order

sflanker|1 year ago

Oh duh, this is inherent in binary counting. When y is equal to one any even x will be a zero. The when y is equal to 2 you get groups of zeros two at a time 0, 1; 4, 5; 8, 9; etc. The pattern repeats in lengthening, self similar way as the values of y increase leaving ever lager gaps and sequences of zeros (with the top edges of the triangles corresponding to powers of two, which give long sequences of zeros or non zeros respectively.

I always think of this pattern geometrically so it’s weird to see it pop out in simple math.