- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

You can multiply large numbers in python directly without worrying about speed. Python supports a "bignum" integer type which can work with arbitrarily large numbers. In Python 2.5+, this type is called long and is separate from the int type, but the interpreter will automatically use whichever is more appropriate.

As long as you have version 2.5 or better, just perform standard math operations and any number which exceeds the boundaries of 32-bit math will be automatically (and transparently) converted to a bignum.

For example,

a = 15421681351 b = 6184685413848 print(a * b)

This will give the output −

95378247708541418748648

- Related Questions & Answers
- How to divide large numbers using Python?
- How to add/subtract large numbers using Python?
- Multiply Large Numbers represented as Strings in C++
- How to multiply large numbers with all digits in the output in R?
- How to handle very large numbers in Python?
- How to Multiply Two Matrices using Python?
- Python program to multiply all numbers in the list?
- PHP – How to multiply two arbitrary precision numbers using bcmul() function?
- Fastest Way to multiply two Numbers
- C++ Program to Multiply two Numbers
- How to generate large random numbers in Java?
- 8085 program to multiply two 8 bit numbers using logical instructions
- C++ Program to Generate Random Numbers Using Multiply with Carry Method
- Large Fibonacci Numbers in C#
- Handling large numbers in C++?

Advertisements