0
function (n)
    i = 1
    s = 1
    while (s <= n)
        i = i+1
        s = s*i
        print "*"
end
Roukah
  • 771
  • 6
  • 13
n303
  • 13
  • 4

1 Answers1

0

Assuming all operations are done in constant time, this loop runs in $\Theta(n!^{-1})$ where $!^{-1}$ is the inverse factorial. Intuitively, the program will enter the loop $i$ times, $i$ being the smallest integer so that $i!\geq n$.

Roukah
  • 771
  • 6
  • 13