I found a code golf challenge that requires you to calculate Conway's Constant to the first 1000 digits. The problem is I couldn't find any place that tells how to calculate this, just websites showing polynomials with a variable x that I do not know what is. I calculated the first 30 numbers in the Look-and-say sequence with this code:
const nums = ["1"],
trailingSequences = seq => {
const num = seq[0];
let counter = 1;
let idx = 0;
for (let i = 1; i < seq; i++) {
if (num == seq[i]) {
counter++
idx = i;
} else {
break
};
}
return [`${counter}${num}`, idx + 1];
},
getNext = previous => {
let next = "";
while (true) {
if (previous == "") {
break
};
const part = trailingSequences(previous);
next += part[0];
previous = previous.slice(part[1]);
}
return next;
}
for (let i = 0; i < 30; i++)
nums.push(getNext(nums[nums.length - 1]))
console.log(nums.join("\n\n\n"));
But I still do not know how to extract Conway's constant regardless.
So, how to calculate Conway's Constant to a modifiable precision in JavaScript?