fractalkitty looking for math? fractalkitty.com

all

kolokoski - initial thoughts

#study#math#number-theory

buildKolakoski

function setup() {
  createCanvas(600, 600);
  noLoop();
  buildKolakoski(5);
  background(255);
  translate(width / 2, height / 2);
  stroke(255);
  strokeWeight(0.2);
  for (let i = 10; i >= 0; i--) {
    d = 0;
    pTwo = pow(2, i);
    towerH = (height / 15) * i;
    towerB = 3;

    for (let j = 0; j < kola.length; j++) {
      if (kola[j] === 1) {
        fill(50 + i * 10, 50 + i * 10, 140 + i * 10);
        rect(d - width / 2, -height / 2, towerB, towerH * 2.5, 0, 0, 50, 50);
        d += towerB;
      } else {
        fill(150 + i * 10, 50 + i * 10, 140 + i * 10);
        rect(
          d - width / 2,
          -height / 2,
          pTwo * towerB,
          2.5 * towerH,
          0,
          0,
          300,
          300
        );
        d += pTwo * towerB;
      }
    }
  }
}

function buildKolakoski(n) {
  for (let i = 2; i < n; i++) {}
}

function draw() {}

kola = [
  1,
  2,
  2,
  1,
  1,
  2,
  1,
  2,
  2,
  1,
  2,
  2,
  1,
  1,
  2,
  1,
  1,
  2,
  2,
  1,
  2,
  1,
  1,
  2,
  1,
  2,
  2,
  1,
  1,
  2,
  1,
  1,
  2,
  1,
  2,
  2,
  1,
  2,
  2,
  1,
  1,
  2,
  1,
  2,
  2,
  1,
  2,
  1,
  1,
  2,
  1,
  1,
  2,
  2,
  1,
  2,
  2,
  1,
  1,
  2,
  1,
  2,
  2,
  1,
  2,
  2,
  1,
  1,
  2,
  1,
  1,
  2,
  1,
  2,
  2,
  1,
  2,
  1,
  1,
  2,
  2,
  1,
  2,
  2,
  1,
  1,
  2,
  1,
  2,
  2,
  1,
  2,
  2,
  1,
  1,
  2,
  1,
  1,
  2,
  2,
  1,
  2,
  1,
  1,
  2,
  1,
  2,
  2,
  1,
  2,
  2,
  1,
  1,
  2,
  1,
  1,
  2,
  1,
  2,
  2,
  1,
  1,
  2,
  1,
  1,
  2,
  2,
  1,
  2,
  1,
  1,
  2,
  1,
  1,
  2,
  2,
  1,
  2,
  2,
  1,
  1,
  2,
  1,
  2,
  2,
  1,
  2,
  1,
  1,
  2,
  2,
  1,
  2,
  2,
  1,
  2,
  1,
  1,
  2,
  1,
  1,
  2,
  2,
  1,
  2,
  2,
  1,
  1,
  2,
  1,
  2,
  2,
  1,
  2,
  1,
  1,
  2,
  1,
  1,
  2,
  2,
  1,
  2,
  1,
  1,
  2,
  1,
  2,
  2,
  1,
  1,
  2,
  1,
  1,
  2,
  1,
  2,
  2,
  1,
  2
];