bin_syr.py

Created by schraf

Created on April 24, 2023

301 Bytes


from kandinsky import *

px, py = 3, 15

def syr(n):
  global px, py
  x = 0
  while n > 1:
    j = 0
    p = n
    while p > 0:
     if 1 & p:
      fill_rect(x, 222 - py - py * j, px, py, (0, 0, 0))
     j += 1
     p >>= 1 
    x += px
    n = 3 * n + 1 if n % 2 else n // 2

syr(27)