// Applied dendrology. Nigel Galloway: February 15., 2021 let uT a=let N,G=Array.create(a+1) true, [|yield! primes64()|>Seq.takeWhile((>)(int64 a))|] let fN n i e=let mutable p=e-1 in (fun()->p<-p+1; if pn<-n*G.[e]; p<-p*G.[e]; l<-l+p; let i=g*l-n in if i<=(int64 a) then Some(n,i,e) else None) let rec fL n g=match n() with Some(f,i,e)->N.[(int i)]<-false; fL n ((fN f i (e+1))::g) |_->match g with n::t->match n() with Some (n,i,e)->fL (fG n i e) g |_->fL n t |_->N.[0]<-false; N fL (fG 1L 0L 0) [fN 1L 0L 1]