This commit is contained in:
Miloslav Ciz 2024-08-06 22:19:44 +02:00
parent 793eff5870
commit 8dbbd1acb0
14 changed files with 1972 additions and 1867 deletions

View file

@ -27,7 +27,6 @@ Below is our standardized [divisor tree](divisor_tree.md) program written in bro
function divisorTreeStr(x)
{
let a = -1, b = -1;
let s = "";
for (let i = 2; i <= x / 2; i++) // find closest divisors
if (x % i == 0)
@ -37,14 +36,10 @@ function divisorTreeStr(x)
if (b <= a)
break;
}
}
s += "("
s += a > 1 ?
divisorTreeStr(a) + " " + x + " " + divisorTreeStr(b) : x;
return s + ")";
return "(" + (a > 1 ? divisorTreeStr(a) + " " + x + " " +
divisorTreeStr(b) : x) + ")";
}
function main()