constbgCol="#447abd";constgCol="#a2c2e8";constnGrid=20;letw;letgSpace;functionsetup(){w=max(400,min(windowWidth,windowHeight)*0.9);gSpace=(w/nGrid)*0.95;describe("the pisano periods shown as a shell where each degree is the modulo dividing the fibonacci sequence with dots drawn at a radius of the remainder - on a blueprint design");createCanvas(w,w);rectMode(CENTER);d=w;angleMode(DEGREES);textSize(16);m=7;s=[];s=pisanoPeriod(m);g=(w-2*gSpace)/2/300;}functiondraw(){background(bgCol);translate(w/2,w/2);drawGrid();t=frameCount/3;noStroke();fill(255);for(leti=1;i<390;i++){lets=[];s=pisanoPeriod(i);for(letk=0;k<s.length;k++){circle(-w/9+g*s[k]*cos(i),w/9+g*s[k]*sin(i),1);}}fill(255,255,255,20);noStroke();fill(gCol);text("modulo",-w/2+10,w/2-5);noLoop();}functionpisanoPeriod(m){if(m<=0)return[];if(m===1)return[0];letsequence=[];leta=0;letb=1;do{sequence.push(a);letc=(a+b)%m;a=b;b=c;}while(!(a===0&&b===1)||sequence.length<2);returnsequence;}functiondrawGrid(){stroke(gCol);strokeWeight(0.3);for(leti=1;i<=nGrid;i++){for(letj=1;j<=nGrid;j++){line(-w/2+gSpace*i,-w/2+gSpace,-w/2+gSpace*i,w/2-gSpace);line(-w/2+gSpace,-w/2+gSpace*i,w/2-gSpace,-w/2+gSpace*i);}}noFill();strokeWeight(3);rect(0,0,w-2*gSpace);}