Search code examples
python-3.xubuntucalculus

Python Stuck Calculating


I am trying to solve a problem using python, and I need to calculate : r =(1^2|~4)**((5&9^3)|3*8**9)

However, the computer is taking forever to finish that operation. Any clue on how to solve this?

Simpler = -5**402653186

SPECS :

OS : Ubuntu 18.04

RAM : 8 Gig

CPU : Intel i5 8Gen


Solution

  • The number you're trying to calculate is very large. -1.45992917087860574535892544169158544350135939488 × 10^281442499 to be precise according to wolfram-alpha. While python longs can be of unlimited length and expand to fill memory it is just a calculation that would take a super long time, try using htop, it should show that ram usage is constantly increasing. You should reconsider on why you are calculating numbers so large.