dt <- as.numeric(readLines("input.txt"))
sum(floor(dt / 3) - 2)
[1] 3512133
x <- 1 total <- 0 sapply(dt, function(x) { total <- 0 val <- x while (floor(val / 3) - 2 >= 0) { val <- floor(val / 3) - 2 total <- total + val } return(total) }) |> sum()
[1] 5265294