Mathober 2026 ยท day 12, Reciprocal Prime Constant
Reciprocal Prime Constant
let primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211]
let t = 0
function setup() {
theSizeThatFits = min(windowWidth, windowHeight)*0.9
theCanvasThatIsFilled=createCanvas(theSizeThatFits, theSizeThatFits);
background(20,70,80);
noFill();
strokeWeight(0.5);
describe("")
}
function draw() {
t+=0.0005
background(20,70,80,10)
translate(width/2,height/2)
c=0
for(let i = 0;i<primes.length;i++){
p = primes[i]
c+=1/p;
for(let j=0;j<p;j++){
stroke(90+80*sin(i*p+t*2),165+70*sin(i*p+t*2),170+80*sin(i*p+t*2))
theta = TWO_PI/p*j;
circle(1.2*p*cos(theta+p+t/p),1.2*p*sin(theta-t),c+p/50)
}
}
}
function keyPressed(){
if(keyCode===83){
save(theCanvasThatIsFilled,"Reciprocal Prime Constant","png")
}
}