[Python] How large of an integer can Python 3 support on a 64-bit system with N gigabytes of...

Discussão em 'Python' iniciado por Stack, Junho 23, 2025.

  1. Stack

    Stack Membro Participativo

    I know that Python 3 supports arbitrary precision arithmetic and so the common answer in all the materials that I have ever seen regarding this topic has been: "The only constraint is the available memory of the system." So, I would just like to know how large integers can Python 3 represent if the 64-bit system has, say, N gigabytes of RAM (e.g. N = 32)?

    A stupid and a naive first thought of mine was that an answer can be found by considering the largest power of 2 representable in the system and this answer is given just by the size of the RAM in bits since the largest power of 2 representable by k bits is 2^k. But this cannot be correct, since 32 gigabytes of RAM is 32 * 2^(30) = 2^(35), which is quite a bit less than numbers close to 2^(64).

    So what is the solution to this (likely quite trivial) problem?

    Continue reading...

Compartilhe esta Página