Python on Ubuntu 18.04.6 LTS
אורי
uri at speedy.net
Tue Jan 4 06:07:43 IST 2022
Hi,
/usr/bin/python is defined on my server as a link to the
deprecated python2.7, and I didn't want to break anything, so I
defined /usr/bin/_py as a link to python3.8. I wanted to check how many
bytes a giga and tera is, so I ran _py -c "print(1024**3)" and _py -c
"print(1024**4)". Then I checked _py -c "print(2**64)" and I wanted to
check _py -c "print(2**64**3)", which I thought will be equal to _py -c
"print(2**192)" (_py -c "print((2**64)**3)"), but no - this gave me a
number with 78914 digits and I'm glad it didn't crash my server (4 or 5 or
6 would have crashed it). Since when 2**64**3 is 2**(64**3) and not
(2**64)**3? Anyway I also checked 2**10**6 (==2**1000000) and I found out
that it contains exactly 10% digits of 6, and I even created a small
program to calculate the powers of 2 that give exactly 10% digits of 6. Are
there powers of 2 which give exactly 10% of each of the digits 0 to 9 (in
decimal form)?
for n in range(1, 10 ** 6 + 1):
a = 2 ** n
b = list(str(a))
s = sum([1 if i == "6" else 0 for i in b])
if (s * 10 == len(b)):
print(n, len(b), s)
Thanks,
אורי
uri at speedy.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20220104/d3de9e7c/attachment.html>
More information about the Linux-il
mailing list