I designed an algorithm where, at some point, I need to compute the product of a list of integers $n_1,\dots,n_m$ (possibly, there are repetitions in the list). The integers themselves do not depend on $m$ but can be, somehow, arbitrarily large.
EDIT: right now, I'm using a naive for loop:
prod=1
for n_i in list:
prod *= n_i
When analyzing this part of the algorithm, I wondered whether I should - or not - consider the multiplication $O(1)$ - i.e. computing the product would only be $O(m)$.
I still looked at what could happen if I considered non-constant multiplication, and noted $M(n)$ the complexity of multiplying two $n$ bit numbers, the complexity would be something like that:
$$\sum_{i=1}^m M\left(\sum_{j=1}^i \log_2 n_i\right)$$
Since multiplying two $n$-bits number leads to a $2n$-bits number. With roughs bounds, I can estimate the complexity as $m \cdot M\left( m\cdot \max_{i=1}^m(\log_2 n_i)\right)$ - as stated in the comment to this question. The bound is tight if I take $m$ copies of the same integer.
I understood that as soon as $n<k$, with a $k$-bit machine, one can consider $M(n)=O(1)$. Does this mean that as soon as $m\cdot \max_{i=1}^m(\log_2 n_i) < k$, I can consider the multiplication $O(1)$ ? I surely must have missed something, because it doesn't feel right: with $m=k$ (say, $32$ or $64$), even with $1$-bits integers, I would exceed $k$.
Any help to better understand this problem is welcome; and since this is for academic purpose, I would be happy to receive some literature recommandation.