Fun with powers of 2

2022-01-03 Thread Michael Shiloh
‪On Tue, Jan 4, 2022 at 10:20 AM ‫אורי‬‎  wrote:‬

> I apologize about the subject. Feel free to change it. The main post was
> about almost crashing my computer with the command  _py -c
> "print(2**64**3)".
> אורי
> u...@speedy.net
>
>
> On Tue, Jan 4, 2022 at 8:01 AM Michael Shiloh 
> wrote:
>
>> Interesting discussion, but the subject seems quite wrong.
>>
>> ‪On Tue, Jan 4, 2022 at 9:32 AM ‫אורי‬‎  wrote:‬
>>
>>> From checking also powers of 3, I can't find more than c==5 (for 3**20
>>> and 3**124).
>>>
>>> אורי
>>> u...@speedy.net
>>>
>>>
>>> ‪On Tue, Jan 4, 2022 at 7:24 AM ‫אורי‬‎  wrote:‬
>>>
 Thank you, that's interesting. So all such numbers are divisible by 9.
 I didn't think about it.

 You might be interested in my related question:

 https://math.stackexchange.com/questions/4348279/what-is-the-highest-number-of-digits-so-that-this-number-of-digits-in-a-specific

 From checking about the first 50,000 powers of 2, I didn't find c more
 than 5, who actually appears only twice (c is the number of digits who
 appear exactly 10% of the time in the decimal form of a specific power of
 2).

 אורי
 u...@speedy.net


 On Tue, Jan 4, 2022 at 6:53 AM Daniel Shahaf 
 wrote:

> אורי wrote on Tue, 04 Jan 2022 04:07 +00:00:
> > Are there powers of 2 which give exactly 10% of each of the digits 0
> to 9 (in
> > decimal form)?
>
> No, because then the sum of the digits would be a multiple of nine, so
> the
> number wouldn't be a power of two.
>
 ___
>>> Linux-il mailing list
>>> Linux-il@cs.huji.ac.il
>>> http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
>>>
>>
___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


Re: Python on Ubuntu 18.04.6 LTS

2022-01-03 Thread אורי
I apologize about the subject. Feel free to change it. The main post was
about almost crashing my computer with the command  _py -c
"print(2**64**3)".
אורי
u...@speedy.net


On Tue, Jan 4, 2022 at 8:01 AM Michael Shiloh 
wrote:

> Interesting discussion, but the subject seems quite wrong.
>
> ‪On Tue, Jan 4, 2022 at 9:32 AM ‫אורי‬‎  wrote:‬
>
>> From checking also powers of 3, I can't find more than c==5 (for 3**20
>> and 3**124).
>>
>> אורי
>> u...@speedy.net
>>
>>
>> ‪On Tue, Jan 4, 2022 at 7:24 AM ‫אורי‬‎  wrote:‬
>>
>>> Thank you, that's interesting. So all such numbers are divisible by 9. I
>>> didn't think about it.
>>>
>>> You might be interested in my related question:
>>>
>>> https://math.stackexchange.com/questions/4348279/what-is-the-highest-number-of-digits-so-that-this-number-of-digits-in-a-specific
>>>
>>> From checking about the first 50,000 powers of 2, I didn't find c more
>>> than 5, who actually appears only twice (c is the number of digits who
>>> appear exactly 10% of the time in the decimal form of a specific power of
>>> 2).
>>>
>>> אורי
>>> u...@speedy.net
>>>
>>>
>>> On Tue, Jan 4, 2022 at 6:53 AM Daniel Shahaf 
>>> wrote:
>>>
 אורי wrote on Tue, 04 Jan 2022 04:07 +00:00:
 > Are there powers of 2 which give exactly 10% of each of the digits 0
 to 9 (in
 > decimal form)?

 No, because then the sum of the digits would be a multiple of nine, so
 the
 number wouldn't be a power of two.

>>> ___
>> Linux-il mailing list
>> Linux-il@cs.huji.ac.il
>> http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
>>
>
___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


Re: Python on Ubuntu 18.04.6 LTS

2022-01-03 Thread Michael Shiloh
Interesting discussion, but the subject seems quite wrong.

‪On Tue, Jan 4, 2022 at 9:32 AM ‫אורי‬‎  wrote:‬

> From checking also powers of 3, I can't find more than c==5 (for 3**20 and
> 3**124).
>
> אורי
> u...@speedy.net
>
>
> ‪On Tue, Jan 4, 2022 at 7:24 AM ‫אורי‬‎  wrote:‬
>
>> Thank you, that's interesting. So all such numbers are divisible by 9. I
>> didn't think about it.
>>
>> You might be interested in my related question:
>>
>> https://math.stackexchange.com/questions/4348279/what-is-the-highest-number-of-digits-so-that-this-number-of-digits-in-a-specific
>>
>> From checking about the first 50,000 powers of 2, I didn't find c more
>> than 5, who actually appears only twice (c is the number of digits who
>> appear exactly 10% of the time in the decimal form of a specific power of
>> 2).
>>
>> אורי
>> u...@speedy.net
>>
>>
>> On Tue, Jan 4, 2022 at 6:53 AM Daniel Shahaf 
>> wrote:
>>
>>> אורי wrote on Tue, 04 Jan 2022 04:07 +00:00:
>>> > Are there powers of 2 which give exactly 10% of each of the digits 0
>>> to 9 (in
>>> > decimal form)?
>>>
>>> No, because then the sum of the digits would be a multiple of nine, so
>>> the
>>> number wouldn't be a power of two.
>>>
>> ___
> Linux-il mailing list
> Linux-il@cs.huji.ac.il
> http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
>
___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


Re: Python on Ubuntu 18.04.6 LTS

2022-01-03 Thread אורי
>From checking also powers of 3, I can't find more than c==5 (for 3**20 and
3**124).

אורי
u...@speedy.net


‪On Tue, Jan 4, 2022 at 7:24 AM ‫אורי‬‎  wrote:‬

> Thank you, that's interesting. So all such numbers are divisible by 9. I
> didn't think about it.
>
> You might be interested in my related question:
>
> https://math.stackexchange.com/questions/4348279/what-is-the-highest-number-of-digits-so-that-this-number-of-digits-in-a-specific
>
> From checking about the first 50,000 powers of 2, I didn't find c more
> than 5, who actually appears only twice (c is the number of digits who
> appear exactly 10% of the time in the decimal form of a specific power of
> 2).
>
> אורי
> u...@speedy.net
>
>
> On Tue, Jan 4, 2022 at 6:53 AM Daniel Shahaf 
> wrote:
>
>> אורי wrote on Tue, 04 Jan 2022 04:07 +00:00:
>> > Are there powers of 2 which give exactly 10% of each of the digits 0 to
>> 9 (in
>> > decimal form)?
>>
>> No, because then the sum of the digits would be a multiple of nine, so the
>> number wouldn't be a power of two.
>>
>
___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


Re: Python on Ubuntu 18.04.6 LTS

2022-01-03 Thread אורי
Thank you, that's interesting. So all such numbers are divisible by 9. I
didn't think about it.

You might be interested in my related question:
https://math.stackexchange.com/questions/4348279/what-is-the-highest-number-of-digits-so-that-this-number-of-digits-in-a-specific

>From checking about the first 50,000 powers of 2, I didn't find c more than
5, who actually appears only twice (c is the number of digits who appear
exactly 10% of the time in the decimal form of a specific power of 2).

אורי
u...@speedy.net


On Tue, Jan 4, 2022 at 6:53 AM Daniel Shahaf  wrote:

> אורי wrote on Tue, 04 Jan 2022 04:07 +00:00:
> > Are there powers of 2 which give exactly 10% of each of the digits 0 to
> 9 (in
> > decimal form)?
>
> No, because then the sum of the digits would be a multiple of nine, so the
> number wouldn't be a power of two.
>
___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


Re: Python on Ubuntu 18.04.6 LTS

2022-01-03 Thread Daniel Shahaf
אורי wrote on Tue, 04 Jan 2022 04:07 +00:00:
> Are there powers of 2 which give exactly 10% of each of the digits 0 to 9 (in
> decimal form)?

No, because then the sum of the digits would be a multiple of nine, so the
number wouldn't be a power of two.

___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


Re: Python on Ubuntu 18.04.6 LTS

2022-01-03 Thread Shlomo Solomon
NOT an answer to your question, but instead of a link to python3.8, I
added 2 lines to .bash_aliases:

alias p="python3.8"
alias p2="python2.7"



On Tue, 4 Jan 2022 06:07:43 +0200
אורי  wrote:

> 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**100) 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,
> 
> אורי
> u...@speedy.net



-- 
Shlomo Solomon
http://the-solomons.net
Claws Mail 3.17.5 - KDE Plasma 5.18.5 - Kubuntu 20.04

___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il


Python on Ubuntu 18.04.6 LTS

2022-01-03 Thread אורי
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**100) 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,

אורי
u...@speedy.net
___
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il