Live data from Hacker News

A prime number whose binary representation looks like a giraffe

reddit.com

41–50 of 82 posts

Re: A prime number whose binary representation looks like a giraffe

#41
post #40
post #32

Here's another challenge: find a number whose binary representation looks like Mickey mouse, and find the index where it occurs in the binary representation of pi. Bonus: that index should have a binary representation that looks like a copyright symbol.

We don't have the digits of pi for the second part. We only have 22,459,157,718,361 digits of pi which is only ~45 bits not enough to create the image with bits left over for moving it around in pi.

How is that only 45 bits?

Re: A prime number whose binary representation looks like a giraffe

#42
Great, another great demonstration of the fundamental principles of digital computing - representation and interpretation of data. It's been my experience teaching CS courses that many students, despite being taught bits and bytes and binary and ASCII and so forth, don't really "get it" until they see things like this.

This particular one only looks like a giraffe when it's interpreted as a 1bpp big-endian bitmap, but you could probably do the same with a colour (24bpp, in whatever order you wish) photo.

Here's another fun idea: write a short program that checks if a file is a prime number. Now you can get into the principles of CRCs, RS, and other error-correction codes...

Re: A prime number whose binary representation looks like a giraffe

#43
post #40

Earlier quoted context omitted.

We don't have the digits of pi for the second part. We only have 22,459,157,718,361 digits of pi which is only ~45 bits not enough to create the image with bits left over for moving it around in pi.

How is that only 45 bits?

Cause that's how the math works. log_2(22,459,157,718,361) ~= 44.35. Powers of two get big really really fast after all.

https://www.wolframalpha.com/input/?i=22,459,157,718,361+to+...

Re: A prime number whose binary representation looks like a giraffe

#44
post #36

Earlier quoted context omitted.

ln 2⁶⁴ⁿ > 2⁶⁴ 64n × ln 2 > 2⁶⁴ n > 2⁵⁸ ∕ (ln 2) ≈ 4.2E+17

Such beautiful superscripts and ≈, but then you used * and / instead of × and ÷… I like to also put plenty of THIN SPACE ( ) in to give it space to breathe, e.g. 2 ⁶⁴ ⁿ and 64 n instead of 2⁶⁴ⁿ and 64n. I make my thin spaces with Compose+Space+'.

THIN SPACE (U+2009) is also good to use to group digits, and is in fact the standard way to group digits in the SI system instead of "," or ".".

That looks nice and gets rid of the confusion over number like "1,234" and "1.234". In the US, the former is the integer 1234 and the later is the rational number 1234/1000. In Germany or France, these would be the other way around. In SI, "1.234" and "1,234" would both be 1234/1000, and the integer 1234 would be "1 234" with the space there being a thin space.

Unfortunately, HN does not support THIN SPACE as far as I can tell.

Reddit is a little better. You can enter it in a comment and it will be correctly saved with the comment and it will display correctly in the browser. As long as you don't need to make any edits to your comment afterwards, it is fine.

If you edit the comment thin spaces are converted to regular spaces when it loads the editing widget, so unless you go through and put all the thin spaces back you will lose them when you save.

Re: A prime number whose binary representation looks like a giraffe

#45
post #43

Earlier quoted context omitted.

How is that only 45 bits?

Cause that's how the math works. log_2(22,459,157,718,361) ~= 44.35. Powers of two get big really really fast after all. https://www.wolframalpha.com/input/?i=22,459,157,718,361+to+...

Shouldn't it be log_2(10^22,459,157,718,361)?

Re: A prime number whose binary representation looks like a giraffe

#46
post #44

Earlier quoted context omitted.

Such beautiful superscripts and ≈, but then you used * and / instead of × and ÷… I like to also put plenty of THIN SPACE ( ) in to give it space to breathe, e.g. 2 ⁶⁴ ⁿ and 64 n instead of 2⁶⁴ⁿ and 64n. I make my thin spaces with Compose+Space+'.

THIN SPACE (U+2009) is also good to use to group digits, and is in fact the standard way to group digits in the SI system instead of "," or ".". That looks nice and gets rid of the confusion over number like "1,234" and "1.234". In the US, the former is the integer 1234 and the later is the rational number 1234/1000. In Germany or France, these would be the other way around. In SI, "1.234" and "1,234" would both be 1…

HN supports THIN SPACE just fine. I used it in my comment, and so did you.

I’m not at all fond of the thin space digit grouping practice; to my Australian eyes it tends to look fairly terrible in most places, like bad kerning.

Your comment also shows another catastrophic weakness of using a regular thin space for digit grouping without additional magic: you need a non-breaking thin space, but there isn’t one. On my comments page, your comment shows the 1 on one line, and the 234 on the next.

I love my YYYY-MM-DD dates (I use it everywhere where the date format isn’t prescribed, and thus get the occasional odd look on forms and such from people aren’t used to that form of date—so you can see I’m not afraid of deviating from local conventions to prefer superior or sometimes merely international ones), but I hate and consequently don’t use thin space digit grouping in general.

Re: A prime number whose binary representation looks like a giraffe

#47
post #39

Earlier quoted context omitted.

Such beautiful superscripts and ≈, but then you used * and / instead of × and ÷… I like to also put plenty of THIN SPACE ( ) in to give it space to breathe, e.g. 2 ⁶⁴ ⁿ and 64 n instead of 2⁶⁴ⁿ and 64n. I make my thin spaces with Compose+Space+'.

Changed * to × (U+00D7 MULTIPLICATION SIGN) and / to ∕ (U+2215 DIVISION SLASH). I don't like ÷, and I can't be bothered about whitespace. Sorry!

I always forget about DIVISION SLASH and that it’s a thing, distinct from FRACTION SLASH (which I use regularly). I wonder if I should add it to my compose key. Nah, I think ÷ and FRACTION SLASH are enough for me.

Re: A prime number whose binary representation looks like a giraffe

#48
post #45
post #43

Earlier quoted context omitted.

Cause that's how the math works. log_2(22,459,157,718,361) ~= 44.35. Powers of two get big really really fast after all. https://www.wolframalpha.com/input/?i=22,459,157,718,361+to+...

Shouldn't it be log_2(10^22,459,157,718,361)?

That answers the question of how many bits of pi we know. If you want to be able to take an arbitrary n-bit string and find its position in a set of n-bit strings, you need to have something like 2^n strings in your set.

So to find the number of bits you can support for an algorithm like this, taking the log of the number of digits of pi we know gives you a rough estimate.

Re: A prime number whose binary representation looks like a giraffe

#49

The last line of the picture contains some 'noise': 0000000000000000000000000000000000000000000000000001000101101001 So the idea is that you produce any 63x64 binary image then you find a number up to 2^64 so that added to the number represented by the first image gives a prime. It's not exactly amazing, but clever enough.

> The last line of the picture contains some 'noise'

Note that if the picture is prime, then the last line must always contain noise... the last digit must be a 1!

I also feel like it's slightly cheating that the first line doesn't contain noise, or a leading 1 digit... the number doesn't naturally fit into 64x64 bits because of all the leading zeroes.

Re: A prime number whose binary representation looks like a giraffe

#50
post #39

Earlier quoted context omitted.

Such beautiful superscripts and ≈, but then you used * and / instead of × and ÷… I like to also put plenty of THIN SPACE ( ) in to give it space to breathe, e.g. 2 ⁶⁴ ⁿ and 64 n instead of 2⁶⁴ⁿ and 64n. I make my thin spaces with Compose+Space+'.

Changed * to × (U+00D7 MULTIPLICATION SIGN) and / to ∕ (U+2215 DIVISION SLASH). I don't like ÷, and I can't be bothered about whitespace. Sorry!

Thank you for writing out that extremely clear sequence of inequalities. I love a good Unicode style debate, but regardless you absolutely nailed it with conceptual clarity.
Post reply on HN