I am learning math with python, when I tried this code for logarithm it give me this error, any help ?
import math
n = 1000000
n2 = 0
for i in range(n):
x = math.log2(i)
n2 += x
print(n2)
it give me a value error : "ValueError: math domain error"
import math
n = 1000000
n2 = 0
for i in range(1,n):
x = math.log2(i)
n2 += x
print(n2)
happy codeing !