| Hosted by CoCalc | Download

Multiplying million digit integers using Javascript!

Expect your browser to completely block for about 5 to 10 seconds... Much better than nothing. (But slower than Sage/Python.)

%javascript const d=1000000; let a=BigInt(9)**BigInt(d) let b=BigInt(7)**BigInt(d) let t = new Date(); let c=a*b print(new Date() - t)

(If you run the above in CoCalc it will output about 5000, which means "5 seconds".... depending on your browser.)

Now in Sage (fraction of a second):

d = 1000000 a = 9^d b = 7^d %time c = a*b
CPU time: 0.02 s, Wall time: 0.02 s

In Python (1-2s):

%python d = 1000000 a = 9**d b = 7**d %time c = a*b
CPU time: 1.46 s, Wall time: 1.59 s