This challenge is based on this Mathematics answer.
Write the shortest program or function that, when given some natural number \$n\$, outputs \$S(n)\$, which is the minimum number of steps for generating a string containing at least \$n\$ copies of the original string, using only select-all, copy, and paste operations.
In the Mathematics answer, \$S(n)\$ is defined asfound to satisfy the formula
$$ S(n) = \min_{i=1, \ldots, 8} 5 \lceil \log_4(n/u_i) \rceil+c_i $$ where \$(c_i, u_i)\$ is a tuple from the set of tuples \$ I = \{ (0,1), (3,2), (7,6), (4,3), (8,9), (12,27), (16,81), (6,5) \}\$.
Test Cases
1 => 0
2 => 3
4 => 5
8 => 8
16 => 10
32 => 13
64 => 15
128 => 18
256 => 20
512 => 23
1024 => 25
2048 => 28
4096 => 30
8192 => 33
16384 => 35
32768 => 38
65536 => 40
131072 => 43
262144 => 45
524288 => 48
1048576 => 50
2097152 => 53
100000 => 42