# =========================================================================== # # Inspired by Numberphile # # Original author: flembobs # Added on: 01.02.2022 # Original URL: www.contextfreeart.org/gallery/view.php?id=4266 # =========================================================================== #

CF::Impure=1 CF::Background = [ b -1 ]

//startshape P(360,1,0,0) [] //startshape P(720,1,0,0) [] //startshape P(100000,1,0.0483394,0) [] //startshape P(100000,1,0..1,0) []

//startshape P(2880,1,0,1) [] //startshape P(2880,1,0,2) [] //startshape P(10000,1,0,3) [] //startshape P(10000,1,0.0483394,3) [] //startshape P(10000,1,0..1,3) []

startshape P(10000,1,0,4) [] //startshape P(10000,1,0..1,4) []

R(n,N,T)=select(T,

N-n,

let(F=mod(n,2)==0;(N-n)*if(F,-1,1)),
let(F=mod(n,3)==0;(N-n)*if(F,-1,1)),
let(F=mod(n,floor(rand_static(1,21)))==0;
  (N-n)*if(F,-1,1)),

let(Q=floor(rand_static(1,2^52));
  F=bitand(1,bitright(Q,mod(n,52)));
  (N-n)*if(F,-1,1))

)

shape P_ (natural n, N, A, D, T) {

if(n > 0)
{
  L[b 1 sat 1]

  transform[x 1]
  transform[ r (A*R(n,N,T)) ]
  transform[ h 1 ]
    P_(n--1,N,(A+D),D,T)[]
}

} shape P ( natural N, A, D, T ) {

P_ (N, N, A, D, T) []

}

path L {

LINETO(1,0)
STROKE()[]

}