Public
Edited
Aug 30, 2023
4 stars
Insert cell
Insert cell
Conway87 = [[17,91], [78,85], [19,51], [23,38], [29,33], [77,29], [95,23], [77,19], [1,17], [11,13], [13,11], [15,2], [1,7], [55,1]]
Insert cell
{
// frac = Conway87, Conway96, Kilminster99, or Kilminster
let frac=Conway87.map(x=>({p:BigInt(x[0]), q:BigInt(x[1])}))
let n=2n, i=0, k=0n, str=`n_0=${n}`
while (i<frac.length) {
if (n%frac[i].q==0) {
n=n/frac[i].q*frac[i].p
i=0; k++;
yield tex`${str}\\ n_{${k}}=${n}`
let r=powerof2(n)
if (r!=-1) str+=`\\\\ n_{${k}}=${n}=2^{${r}}`
await Promises.delay(1) // you can slow it down
}
else i++
}
return n
}
Insert cell
powerof2 = (n)=>{
let r=0n
while (n>1n && n%2n==0n) {n/=2n; r++}
return (n==1n) ? r : -1
}
Insert cell
Insert cell
Insert cell
Conway96 = [[17,91], [78,85], [19,51], [23,38], [29,33], [77,29], [95,23], [77,19], [1,17], [11,13], [13,11], [15,14], [15,2], [55,1]]
Insert cell
Insert cell
Kilminster99 = [[7,3], [99,98], [13,49], [39,35], [36,91], [10,143], [49,13], [7,11], [1,2], [91,1]]
Insert cell
Kilminster = [[3,11], [847,45], [143,6], [7,3], [10,91], [3,7], [36,325], [1,2], [36,5]]
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more