The following code creates an "utopian tree" that grows faster the more often it is cycled. The function creates a loop that keeps track of the cycle number, as well as the height of the tree. The code cycles through the loop at a rate of 1 per 2.
function utopianTree(n) {
let cycle = 1;
let height = 1;
while (cycle <= n){
if(cycle % 2 !== 0 ){
height *= 2;
}else{
height++;
}
cycle++;
}
return height;
}