Live data from Hacker News

A prime number whose binary representation looks like a giraffe

reddit.com

61–70 of 82 posts

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

#61
post #6
post #5

Did somebody stumble upon this by accident, or did they deliberately look for a prime number and play with the layout until they saw a picture? Either way, this is really cool.

They made/got the picture, converted it to a number (by interpreting it as binary), then incremented the number until they found the next prime. The incrementing is what made the "noise" in the bottom right.

Thanks for explanation. It does take away the magic, though.

It's still way cool, but how much cooler woulc it have been if a mathematician had stumbled upon this by accident...

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

#62
post #52

Earlier quoted context omitted.

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 c…

OK, this is odd. It looks like something browser dependent is going on. You earlier comment shows up with thin spaces on Chrome for me, but not on Safari or Firefox. I know Firefox handles thin spaces, because it handles this Reddit comment just fine: https://www.reddit.com/r/Physics/comments/67g28i/because_gra... I'm going to paste the examples from there here and see what happens: 1​234​567 (U+200B, ZERO WIDTH SPAC…

Looks good with Firefox on Linux too.

Given chrismorgan's comment about breaking, it seems that NARROW NO-BREAK SPACE would be a better choice for digit grouping, right?

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

#64
post #15

I think the more interesting way to do this would be to create a border that's roughly circular to frame the giraffe, and fill that border with noise. Then do the incrementing thing, and your 12 or so bits of noise at the end will blend in better, making it harder for the average person to reverse engineer. I'm imaging something like this, but with a giraffe instead: https://6d4be195623157e28848-7697ece4918e0a73861de…

I had the same sort of idea, and just implemented it in Python using gmpy2 for the primality check. Here's a prime smiley face: 111010101111001000110101111111001001000010000 000000000000000000000000000000000000000000001 000000000000000001110111111100000000000000001 100000000000011110000000000011010000000000001 000000000011100000000000000000011100000000000 100000000100000000000000000000000011000000001 1000000110000000…

Playing with the wrap width (in this case 94), you'll see a small herd of giraffes instead. (This is the prime from the reddit article, rather than your smiley face. Easier to see white on black.)

    100000000000000000000000000000000000000000000000000000000000000110000000000000000000000000000000
    000000000000000000000000000000111000000000000000000000000000000000000000000000000000000000000111
    110000000000000000000000000000000000000000000000000000000000111111000000000000000000000000000000
    000000000000000000000000000011111110000000000000000000000000000000000000000000000000000000011111
    111000000000000000000000000000000000000000000000000000000001000011110000000000000000000000000000
    000000000000000000000000000000000111000000000000000000000000000000000000000000000000000000000000
    011110000000000000000000000000000000000000000000000000000000000000111100000000000000000000000000
    000000000000000000000000000000000011110000000000000000000000000000000000000000000000000000000000
    000111100000000000000000000000000000000000000000000000000000000000011111000000000000000000000000
    000000000000000000000000000000000000111110000000000000000000000000000000000000000000000000000000
    000011111100000000000000000000000000000000000000000000000000000000000111111100000000000000000000
    000000000000000000000000000000000000011111111100000000000000000000000000000000000000000000000000
    000000111111111100000000000000000000000000000000000000000000000000000011111111111000000000000000
    000000000000000000000000000000000000000111111111111000000000000000000000000000000000000000000000
    000000001111111111111100000000000000000000000000000000000000000000000000111111111111111100000000
    000000000000000000000000000000000000000011111111111111111000000000000000000000000000000000000000
    000000001111111111111111110000000000000000000000000000000000000000000000111111111111111111000000
    000000000000000000000000000000000000000011111111111111111110000000000000000000000000000000000000
    000000001111111111111111111000000000000000000000000000000000000000000000011111111111111111100000
    000000000000000000000000000000000000000001111111111111111110000000000000000000000000000000000000
    000000000111100001111111110000000000000000000000000000000000000000000000011110000011111111000000
    000000000000000000000000000000000000000001111000000111111100000000000000000000000000000000000000
    000000001111100000011111110000000000000000000000000000000000000000000000110110000000110111000000
    000000000000000000000000000000000000000011011000000011101110000000000000000000000000000000000000
    000000011001100000001110111000000000000000000000000000000000000000000001100110000000111001110000
    000000000000000000000000000000000000000110011000000011100110000000000000000000000000000000000000
    000000011001100000001100011000000000000000000000000000000000000000000000110010000000100001100000
    000000000000000000000000000000000000000001001000000110000110000000000000000000000000000000000000
    000000000011100000010000011000000000000000000000000000000000000000000000001110000011000001100000
    000000000000000000000000000000000000000000011000011000000110000000000000000000000000000000000000
    000000000001100001100000011000000000000000000000000000000000000000000000000111001100000001100000
    000000000000000000000000000000000000000000011100110000000110000000000000000000000000000000000000
    000000000001010011000000010000000000000000000000000000000000000000000000001100000000000011000000
    000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
    000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
    000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
    000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
    000000000000000000000000000000000000000000000000000000000000001000101101001

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

#65
post #64
post #15

Earlier quoted context omitted.

I had the same sort of idea, and just implemented it in Python using gmpy2 for the primality check. Here's a prime smiley face: 111010101111001000110101111111001001000010000 000000000000000000000000000000000000000000001 000000000000000001110111111100000000000000001 100000000000011110000000000011010000000000001 000000000011100000000000000000011100000000000 100000000100000000000000000000000011000000001 1000000110000000…

Playing with the wrap width (in this case 94), you'll see a small herd of giraffes instead. (This is the prime from the reddit article, rather than your smiley face. Easier to see white on black.) 100000000000000000000000000000000000000000000000000000000000000110000000000000000000000000000000 000000000000000000000000000000111000000000000000000000000000000000000000000000000000000000000111 11000000000000000000000000000…

Nice results at 192 (also three giraffes) and at 256 (four giraffes).

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

#66

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, bu…

"write a short program that checks if a file is a prime number."

What do you mean? I tried googling but failed.

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

#67
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)?

The person I was responding to had a two-ish step problem 1) find a number with a binary representation that looks like Mickey 2) find an index for that number in pi that looks like the copyright symbol. Both are conceivably possible because pi is infinite and it's decimal places contain all numbers somewhere but we only know so many actual digits. Since we're dealing with the index of the number from step 1 though the number of bits we have to find the copyright symbol in is only log_2(22,459,157,718,361) ~= 45 because it's the index we're after.

That gives a roughly 7x7 grid to draw © in which is pretty limited and might be the minimum viable for a clean ©. (and that's been a touch generous by allowing 0 padding on the front of the number)

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

#68
post #18

Earlier quoted context omitted.

> primes are very common Isn't it thought that they get more and more rare the further you go away from zero in the positive direction? By the way I just realized why no negative numbers are prime and that's because -1 is a factor in all of them. Quite obvious but I just never thought about it before.

-1 is not a prime, so that doesn't work. The actual reason is a little more boring - negative numbers are not prime by the definition of a prime number: "a natural number greater than 1 that cannot be formed by multiplying two smaller natural numbers" (Wikipedia).

There's another definition, that doesn't have to exclude the one explicitly. I think it's a natural number not divisible by any natural number smaller than itself.

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

#69
post #18

Earlier quoted context omitted.

-1 is not a prime, so that doesn't work. The actual reason is a little more boring - negative numbers are not prime by the definition of a prime number: "a natural number greater than 1 that cannot be formed by multiplying two smaller natural numbers" (Wikipedia).

There's another definition, that doesn't have to exclude the one explicitly. I think it's a natural number not divisible by any natural number smaller than itself.

*other than one

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

#70
post #62
post #52

Earlier quoted context omitted.

OK, this is odd. It looks like something browser dependent is going on. You earlier comment shows up with thin spaces on Chrome for me, but not on Safari or Firefox. I know Firefox handles thin spaces, because it handles this Reddit comment just fine: https://www.reddit.com/r/Physics/comments/67g28i/because_gra... I'm going to paste the examples from there here and see what happens: 1​234​567 (U+200B, ZERO WIDTH SPAC…

Looks good with Firefox on Linux too. Given chrismorgan's comment about breaking, it seems that NARROW NO-BREAK SPACE would be a better choice for digit grouping, right?

Yeah, NARROW NO-BREAK SPACE is probably better.

As far as the display problem on Firefox and Safari on Mac goes, I've done some experimenting. It looks like it is a font thing. HN has "font-family:Verdana, Geneva, sans-serif;" as part of the style sheet.

I made a minimal test page with just the different space examples, and an internal style sheet that just set the font-family for the body, and it shows the problem. Changing it to "Arial, sans-serif" makes it work.

I've never looked seriously into fonts for browsers, so have no idea what is going on at this point. If there is a problem with the Mac versions of Verdana and/or Geneva, then why is it only affecting Firefox and Safari, and not Chrome, on my Mac?

If anyone else wants to try to figure this out, here is the test page I've been using:

  
  
      
      space test
      
          body { font-family:Verdana, Geneva, sans-serif; }
          xbody { font-family:sans-serif;}
          xbody { font-family:Arial, sans-serif;}
      
      
  
  
  

1​234​567 (U+200B, ZERO WIDTH SPACE)
1 234 567 (U+200A, HAIR SPACE)
1 234 567 (U+202F, NARROW NO-BREAK SPACE
1 234 567 (U+2009, THIN SPACE)
1 234 567 (U+2006, SIX-PER-EM SPACE)
1 234 567 (U+2008, PUNCTUATION SPACE)
1 234 567 (U+2005, FOUR-PER-EM SPACE)
1 234 567 (U+2004, THREE-PER-EM SPACE)
1 234 567 (U+0020, SPACE)
1 234 567 (U+2000, EN QUAD)
1 234 567 (U+2002, EN SPACE)
1 234 567 (U+2007, FIGURE SPACE)
1 234 567 (U+2003, EM SPACE)
1 234 567 (U+2001, EM QUAD)

Post reply on HN