mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   enzocreti (https://www.mersenneforum.org/forumdisplay.php?f=156)
-   -   which is the smallest even number... (https://www.mersenneforum.org/showthread.php?t=24915)

enzocreti 2019-11-06 15:14

which is the smallest even number...
 
which is the smallest even number N (in base 10) such that converted in base 2 contains five 1's?


I guess 94?

Uncwilly 2019-11-06 15:30

62[SUB]10[/SUB] is 111110[SUB]2[/SUB]

retina 2019-11-06 16:55

N = 2

2[sub]10[/sub] = 1.1111.....[sub]2[/sub]

VBCurtis 2019-11-06 17:25

[QUOTE=retina;529814]N = 2

2[sub]10[/sub] = 1.1111.....[sub]2[/sub][/QUOTE]

That contains more than 5 ones.

retina 2019-11-06 17:56

[QUOTE=VBCurtis;529815]That contains more than 5 ones.[/QUOTE]Yes. The criterion is that is contains five ones. And it does. It also contains some more ones. It didn't say five ones and only five ones.

VBCurtis 2019-11-06 18:12

It also didn't say "at least 5 ones".

If I asked for a recipe using 3 eggs, and you gave me a recipe using infinite eggs, I wouldn't find you very helpful.

retina 2019-11-06 18:15

[QUOTE=VBCurtis;529819]If I asked for a recipe using 3 eggs, and you gave me a recipe using infinite eggs, I wouldn't find you very helpful.[/QUOTE]But you might find me pedantic. :razz:

M344587487 2019-11-06 18:25

If we're going for pedantry points then you missed negative numbers. Pick a representation of negative numbers in binary, pick a fixed or variable word representation, pick how you define smallest. Naturally you'd think a<b for smallest, but the base 10 specification allows for an interpretation as the least number of digits when written in base 10.

-0 is 11111 in one's complement with a 5 bit word. It's the default winner of "least number of digits when written in base 10".

retina 2019-11-06 18:32

[QUOTE=M344587487;529821]-0 is 11111 in one's complement with a 5 bit word. It's the default winner of "least number of digits when written in base 10".[/QUOTE]2 and -0 have the [i]same[/i] "number of digits when written in base 10". But 2 has fewer characters than -0. :razz:

But a true pedant might interpret "smallest" to be numerical value. And if we are allowed to twist the definition boolean arithmetic with infinity: "-(∞ AND (∞ XOR 1))" has an infinity of 1's with the last digit as 0.

[size=1]Now we just need to define AND and XOR when dealing with infinities.[/size]

xilman 2019-11-06 20:28

[QUOTE=VBCurtis;529819]It also didn't say "at least 5 ones".

If I asked for a recipe using 3 eggs, and you gave me a recipe using infinite eggs, I wouldn't find you very helpful.[/QUOTE]Reminds me of the programmer who, before he went shopping, was told by his wife: "Buy a loaf of bread and, if they have any eggs, get a dozen." He came back with 12 loaves of bread and no eggs.

Dr Sardonicus 2019-11-06 21:52

[QUOTE=retina;529814]N = 2

2[sub]10[/sub] = 1.1111.....[sub]2[/sub][/QUOTE]

The question specified "converted in base 2."

Please explain the algorithm by which you convert 2[sub]10[/sub] into base two, so as to get 1.111... rather than 10.

xilman 2019-11-06 22:16

[QUOTE=Dr Sardonicus;529836]The question specified "converted in base 2."

Please explain the algorithm by which you convert 2[sub]10[/sub] into base two, so as to get 1.111... rather than 10.[/QUOTE]oh dear.

It's the same as 1.999999999... in decimal.

a1call 2019-11-07 00:51

[QUOTE=enzocreti;529804]which is the smallest even number N (in base [B]10[/B]) such that converted in base 2 contains five 1's?

[/QUOTE]
Well, since the OP does not specify that "10" is a decimal notation it is quite obvious to me that 10 is equal to the number which is normally represented as 19 in decimal notation. So the [B][U]correct[/U][/B] answer is obviously [B]2613660[/B] (when written in decimal notation.:smile:

[url]https://www.wolframalpha.com/input/?i=Convert+111111_19+to+decimal[/url]
:smile:
ETA: Oops, got the 1's in the wrong base.
But at least I learned something: An odd number of 1's in an odd base will never evaluate to an even number, regardless of any 0's present anywhere.:smile:

Dr Sardonicus 2019-11-07 01:37

[QUOTE=xilman;529840]oh dear.

It's the same as 1.999999999... in decimal.[/QUOTE]
Maybe, but [b]retina[/b] specified 2[sub]10[/sub], not "1.999999999... in decimal."

You have to invoke limits to say they're "the same."

In any case, it doesn't answer my question -- what's the conversion algorithm?

It can reasonably be argued that using .999999999... in decimal, or .1111111... in binary to express an integer isn't algorithmic because the decimal or binary expansions do not terminate, so they can not express an integer exactly using a finite number of arithmetic operations with integers.

Uncwilly 2019-11-07 02:14

2[SUB]10[/SUB] = the following in binary [TEX]10^{1^{1^{1^1}}}[/TEX]

retina 2019-11-07 03:42

[QUOTE=Dr Sardonicus;529836]The question specified "converted in base 2."

Please explain the algorithm by which you convert 2[sub]10[/sub] into base two, so as to get 1.111... rather than 10.[/QUOTE]Okay, sure. Here is my method.

I start with 1[sub]2[/sub] and convert to base 10 to get 1[sub]10[/sub]. Too small.
Then I try 1.1[sub]2[/sub] and convert to base 10 to get 1.5[sub]10[/sub]. Too small.
Then I try 1.11[sub]2[/sub] and convert to base 10 to get 1.75[sub]10[/sub]. Too small.
Then I try 1.111[sub]2[/sub] and convert to base 10 to get 1.875[sub]10[/sub]. Too small.
Then I try 1.1111[sub]2[/sub] and convert to base 10 to get 1.9375[sub]10[/sub]. Too small.
... <repeat ∞ times> ...
Then I try 1.1111....[sub]2[/sub] and convert to base 10 to get 2[sub]10[/sub]. Yay. Found it. :tu:

a1call 2019-11-07 04:06

Decimal 2 is a defined mathematical quantity.
1.11...[SUB]2[/SUB] is not a defined mathematical quantity so it can not be equal to 2.
This is despite the fact that the limit of the sum
1+1/2+1/4+... converges to 2 as the number of addends approaches Infinity (an undefined quantity).

axn 2019-11-07 04:21

[QUOTE=retina;529864]... <repeat ∞ times> ...
[/QUOTE]
...is not an algorithm

retina 2019-11-07 04:35

[QUOTE=a1call;529866]1.11...[SUB]2[/SUB] is not a defined mathematical quantity so it can not be equal to 2.[/QUOTE]Are you sure about that?

retina 2019-11-07 04:41

Oh, WP has an article about it.

[url]https://en.wikipedia.org/wiki/0.999[/url]... [quote]This number is equal to 1. In other words, "0.999..." and "1" represent the same number. There are many ways of showing this equality, from intuitive arguments to mathematically rigorous proofs.[/quote]WP said it, so it must be true.

Uncwilly 2019-11-07 22:25

[COLOR="DarkOrange"][FONT="Arial Black"][SIZE="3"]Mod note:[/SIZE][/FONT][/COLOR]
Timekeeping posts split off to this thread:
[url]https://www.mersenneforum.org/showthread.php?t=24923[/url]

This the post that started it and refers to the prior posts in this thread:[QUOTE=rudy235;529870]How many months of the year have 28 days? Answer 12 . (all months have 28 days) Same thing here.[/QUOTE]

kriesel 2020-07-05 03:54

[QUOTE=xilman;529828]Reminds me of the programmer who, before he went shopping, was told by his wife: "Buy a loaf of bread and, if they have any eggs, get a dozen." He came back with 12 loaves of bread and no eggs.[/QUOTE]
His programmer wife could have asked, why he came home one loaf short.
Buy a loaf (1), + if (they have any eggs) get 12 (loaves). 1+12=13.

xilman 2020-07-05 08:40

[QUOTE=kriesel;549790]His programmer wife could have asked, why he came home one loaf short.
Buy a loaf (1), + if (they have any eggs) get 12 (loaves). 1+12=13.[/QUOTE]To which he would reply "you used the AND operator, not PLUS.

LaurV 2020-07-15 17:23

[QUOTE=xilman;549800]To which he would reply "you used the AND operator, not PLUS.[/QUOTE]
To which he should come with no loafs (1 and 12 = 0) :razz:

xilman 2020-07-15 19:20

[QUOTE=LaurV;550688]To which he should come with no loafs (1 and 12 = 0) :razz:[/QUOTE]logical AND , not bitwise AND

kruoli 2020-07-15 20:09

So 1 AND 12 = true?

xilman 2020-07-16 06:30

[QUOTE=kruoli;550707]So 1 AND 12 = true?[/QUOTE]

In Perl:

&buy ($have_eggs ? 12 : 1, $loaf)

retina 2020-07-16 06:51

[QUOTE=xilman;550747][QUOTE=kruoli;550707]So 1 AND 12 = true?[/QUOTE]

In Perl:

&buy ($have_eggs ? 12 : 1, $loaf)[/QUOTE]Where is the AND?

LaurV 2020-07-18 08:54

[QUOTE=xilman;550701]logical AND , not bitwise AND[/QUOTE]
Every one with his domain, I work very close to metal :razz:


All times are UTC. The time now is 04:39.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.