[Tutor] Is there a Big Integer Class in Python?

Satya Luzy wuzzyluzy at gmail.com
Tue Dec 22 09:22:03 EST 2015


Is there a way to extend the numbers so that there is no more L?

Thanks :)

On Tue, Dec 22, 2015 at 8:29 PM, Alan Gauld <alan.gauld at btinternet.com>
wrote:

> On 22/12/15 10:05, Satya Luzy wrote:
> > I'm currently making a cryptanalysis program that involves up to 150
> > integer digits.
> > The number will be used for multiplication and exponentiation purpose.
> > So, do I need to use something like a big integer class? or does that
> even
> > exist?
>
> Python integers are effectively big integers, no need of a special
> class. Just use normal integers.
>
> If in doubt try this (using Python v2):
>
> >>> print 2 ** 500
> 327339060789614187001318969682759915221664204604306
> 478948329136809613379640467455488327009232590415715
> 0886684127560071009217256545885393053328527589376L
>
> Notice the L at the end? That tells you python is using a
> long integer. You only see that in Python v2. If you are
> using v3 there is no L and no distinction between long
> and regular integers.
>
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.amazon.com/author/alan_gauld
> Follow my photo-blog on Flickr at:
> http://www.flickr.com/photos/alangauldphotos
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list