Modulo Big O Problem I know this may be really basic, but I am unsure of the complexity of this procedure in Python:
def modten(n):

   return n%10

edit: It is done with Python. That is the only additional information provided for this question. The question asks to specify the order of growth
 A: If $n$ is represented as a bit string, then $n$ mod $10$ can be computed in time $O(\log n)$ (which is presumably what you meant when you wrote $O(n)$, i.e., you were calling $n$ is the number of bits of the parameter $n$, because otherwise complexity $O(n)$ would be absurdly large).  Indeed, one can compute $n$ mod $10$ using a deterministic finite automaton with $10$ states, which is defined if $n$ is read starting from the big end, by having a transition from state $k$ to state $2k$ upon reading a $0$ and $k$ to $2k+1$ upon reading a $1$, where states are labeled mod $10$ (e.g., from state $6$ we move to state $2$ or $3$ according as we read a $0$ or $1$), and finally returning the final state after all bits are read.  Obviously, this is done in linear time, i.e., $O(\log n)$.
The answer $O(\log n\, \log\log n)$ would be plausible if the parameter $10$ were not kept fixed and $n$ stands for the max of the two inputs (although I'm not sure we know how to do division that quickly; $O(\log n\, (\log\log n)^2)$ is more like it).
A: Using computer primitive types (say 64-bit long and double) the algorithm should be at least as fast as this:  
return n - 10*floor(n / 10)

Wich performs $4 = \mathcal O(1)$ operations (divide, floor, multiply, subtract).
According to this it uses an algorithm wich is (according to the accepted answer) $\mathcal O(\log n)$ (proportional to the product of the length ($\sim\log$) of the two numbers). The comments, however, claim $\mathcal O(n^2)$ (wich is a lot worse).
