0
how does ** works (python)
i've created program, which runs a while, than stops and doesn't return anything, i've tried running only part where is power: n = 2 ** (2 ** 5 - 1) - 1 a = 2 ** (n - 1) #line, where program stops working, out of memory print(a) does anybody knows how to solve this?
4 odpowiedzi
+ 3
(2**31 - 1) is a pretty large value. Then in next line you have-
(2**(2**31-1)-1) is still bigger. So you cannot accomodate that is all I'm saying.
+ 2
2**5 means 2*2*2*2*2, it is exponentiation.
- 1
well, i know what does ** do... it's power function, the question maybe should be, how to make power for laaarge numbers, which overflows memory
- 1
ok, thanks