On 21-1-2015 20:06, Chris Angelico wrote: > On Thu, Jan 22, 2015 at 5:20 AM, Irmen de Jong <irmen.nos...@xs4all.nl> wrote: >> On 21-1-2015 18:59, Steve Hayes wrote: >> >>> 3. When I started to look at it, I found that strings could be any length >>> and >>> were not limited to swomething arbitrary, like 256 characters. >> >> Even more fun is that Python's primitive integer type (longs for older >> Python versions) >> has no arbitrary limitation either. >> >> That amazed me at the time I discovered python :) > > I hadn't worked with length-limited strings in basically forever > (technically BASIC has a length limit, but I never ran into it; and I > never did much with Pascal), but you're right, arbitrary-precision > integers would have impressed me a lot more if I hadn't first known > REXX. So... is there a way to show that off efficiently? Normally, any > calculation that goes beyond 2**32 has already gone way beyond most > humans' ability to hold the numbers in their heads. > > ChrisA >
Something silly that I just thought about (Python 3): number = 2 * 3 * 5 * 103 # okay. number = number * 3120937 * 6977407 * 8431103 # hmm... number = number * 70546381234168412430433268433712277793053956898109255590133639943 print("I know a huge number, it is:", number) secret_message = number.to_bytes(37, "big") print(secret_message) Or perhaps: (after pip install pyprimes) >>> number = 1402811054100763300785480817886711606823329164566977593890 # wow? >>> import pyprimes.factors >>> print(pyprimes.factors.factorise(number)) [2, 3, 5, 557, 1559, 3413, 6991, 27799, 41333, 52999, 104681, 247001, 992441, 1111211, 1299689] >>> Irmen -- https://mail.python.org/mailman/listinfo/python-list