boolean prime[]; int maxPrime; int k; float diam; void setup() { size(800, 800); background(0); frameRate(.5); diam = 50; maxPrime = floor(width/diam)*floor(height/diam); prime = new boolean [maxPrime]; // make all numbers prime for (int i=0; imaxPrime) stop(); } void displayCircles(boolean prime[], int maxPrime, float diam) { int j; j = 0; for (float y=0; y+diam<=height; y+=diam) { for (float x=0; x+diam<=width; x+=diam) { circle(x, y, diam, prime[j], color(120, 200, 255), color(0), str(j)); j++; } } } void circle(float x, float y, float diam, boolean state, color tColor, color fColor, String text) { // ellipse stuff if (state) fill(tColor); else fill(fColor); stroke(0); ellipseMode(CORNER); ellipse(x, y, diam, diam); // text stuff textAlign(CENTER, CENTER); textSize(diam*.4); fill(0); text(text, x+diam/2, y+diam/2); }