
Images Created from Prime Numbers - sohkamyung
https://www.futilitycloset.com/2020/01/12/more-prime-images/
======
egypturnash
Mostly unrelated but this made me check to see if the Prime Number Shitting
Bear is still online. It is!
[https://alpha61.com/primenumbershittingbear/](https://alpha61.com/primenumbershittingbear/)

~~~
JKCalhoun
The classic prime joke (saw it originally in Sci Am back in the ... 70's?
80's?). Found an approximation when I googled it:

A mathematician, physicist, and engineer are taking a math test. One question
asks "Are all odd numbers prime?"

The mathematician thinks, "3 is prime, 5 is prime, 7 is prime, 9 is not prime
-- nope, not all odd numbers are prime."

The physicist thinks, "3 is prime, 5 is prime, 7 is prime, 9 ... experimental
error, 11 is prime, 13 is prime, yes, they're all prime."

The engineer thinks, "3 is prime, 5 is prime, 7 is prime, 9 is prime, 11 is
prime, ..."

~~~
askvictor
The version I remember has the mathematician thinking: "3 is prime, 5 is
prime, 7 is prime, so by mathematical induction, all odd numbers are prime".

~~~
javajosh
It just occurred to me how strange it is that you can get to some numbers by
addition that you cannot get to by multiplying _any subset_ of the earlier
sequence. Emotionally, it feels like addition and multiplication are arguing
over who's better, and multiplication is like "I'm so fast", and addition is
like, "I'm slow but, I can go places you _can 't_".

It'd be cool, if there was a Maker, that they make it so that some very large
prime number is a message to all intelligent life capable of computing and
deciphering it. This kind of message would penetrate even nested, simulated
universes, and could only come from World 0, assuming the properties of
numbers are independent of physical constants. Why not have a SETI-in-the-
primes project, after all?

~~~
skissane
> It'd be cool, if there was a Maker, that they make it so that some very
> large prime number is a message to all intelligent life capable of computing
> and deciphering it

Every possible message is already there. Just like how Borges’ Library of
Babel contains every possible book (within its limits of size and format)

~~~
javajosh
That cannot be true. It does not contain the message '4'. (Or any of the non-
primes.)

In fact it seems like there must be many more non-primes than primes over any
finite interval (for the simple reason that multiplication gets a lot of
whacks at the piñata, e.g. producing a product landing in that finite
interval.)

So to answer your implied question ("why bother commucating with primes
anwyay?") I guess the value of limiting your message to "a really big prime
number" is to make discovery hard, but still tenable. It should be pretty big,
like big enough for a good bible sized book, say 1 gigabyte, and start with
something really obviously artificial, or unexpected looking, like starting as
a 1 with 20,000 zeroes, or maybe better, 20k perfect 010101 and then after a
few thousand, 00110011, and from there establish a language protocol, and
write the book. But you'd have to expect people to check only primes for these
simple patterns, because it's really easy to produce meaningful sequences with
addition, and really hard with multiplication (AFAIK).

~~~
skissane
> That cannot be true. It does not contain the message '4'. (Or any of the
> non-primes.)

Any finite message (containing a finite number of symbols drawn from a finite
alphabet) can be represented as a positive integer.

Any positive integer n can be encoded in a prime, even a composite integer.

Use the following encoding system: write 1 n times, followed by a zero,
followed by an arbitrary bit string.

For example, for 4: 11110xxxxxxxxxxxxx...

Using that encoding system, there will be an infinite number of primes that
encode 4 - all the primes which start with 11110 in binary.

Thus, the set of all primes contains an infinite number of copies of every
possible finite message.

~~~
javajosh
I meant that the entire message is "4", not just part of the message.
Obviously we can pick a subset of digits of any large prime and find anything
we want. However, the odds of a very large prime (like a gigabyte) looking
intentionally ordered over its entire length seems vanishingly small.

The only reason to limit ourselves to primes is because its trivial to produce
a meaningful composite, and very difficult to produce a meaningful prime. Take
this message; if I was to associate it with a number (say by joining its
characters as 7-bit ASCII), my money is that it's composite. (Not sure what
the odds are, but I'd take 100:1 odds).

EDIT: period is `01110`, which is even, so I win.

~~~
skissane
> However, the odds of a very large prime (like a gigabyte) looking
> intentionally ordered over its entire length seems vanishingly small.

Can we estimate how many gigabyte sized primes exist? I think one can do that
using the prime number theorem. Let’s call that N. What is the probability one
of those N messages is meaningful? I think it is a lot higher than you think
it is. I think N is a very big number, even though it is very small compared
to the number of composite gigabyte-sized numbers, it is still unimaginably
large in absolute terms.

~~~
javajosh
PNT, interesting! If I'm reading it correctly you can estimate the number of N
digit primes as 10^N/N. That's basically 10^N, and for N=9 (a billion), that
means there's (very very roughly) a billion primes with a billion digits.

I mean, it's not that many if _your expecting a message from God_ (I say half-
jokingly).

~~~
skissane
Suppose somewhere out there, there is an ISO of Bible software, and it just so
happens that when expressed as an integer it turns out to be prime – proof
that the Bible is God's word, or freak coincidence? I think most people would
go with the second option. And, the same would be just as true if it was an
ISO of some other religious scripture, such as the Quran or the Vedas.

~~~
javajosh
Well it would be an impressive feat, regardless. But of course there are a lot
of degrees-of-freedom if you were to attempt this. Tiny formatting and
encoding decisions would all greatly influence the resulting integer. Because
it's so sensitive to chosen input, I would say even if you managed to produce
a prime, it's not very satisfying as a sort of Godly checksum and signature.

Much more interesting is to discover a new communication, a message encoded in
a very large number that is distinguished by being prime. (What message would
you send? It would be interesting if it ultimately described some sort of
recursive, reactive automata, the source code for a kind of learning,
communicating intelligence. A gift, then. An awesome, terrible gift.)

------
snowwrestler
There’s a great scene in the end of the book “Contact” by Carl Sagan where the
main character uses super powerful computers to find a raster image of a
circle hidden deep in the digits of pi. This is supposed to be a moment of
deep spiritual significance.

But in fact, it’s basically an expected outcome given what we think we know
about pi.

At first glance these images were startling to me; that such recognizable
images could be “hidden” in the primes... in the very structure of
mathematics! But then I realized that with an infinite numbers of primes
available to us, nothing is hidden. It’s more like the primes are simply
building blocks for us to use in constructing images of whatever we want.

~~~
lonelappde
Not quite true. Sagan's version was better than that analysis suggests:
[http://kasmana.people.cofc.edu/MATHFICT/mf55-spoiler.html](http://kasmana.people.cofc.edu/MATHFICT/mf55-spoiler.html)

> as Sagan puts it in the story itself, the surprise is not that it appears
> that it appears "so early" in the sequence.

~~~
yesenadam
It seems there was a large (unconscious?) religious dimension to SETI. Michael
Shermer:

[David Swift in his 1990 book _SETI Pioneers_ ] asked each of the SETI
pioneers about their parents’ religiosity... most were raised in a religious
household but that not one believes in anything like the traditional Judeo-
Christian God... Astronomer Frank Drake, ostensively the SETI pioneer if there
was one (and creator of the infamous “Drake equation” for computing the
probability of ETIs), who was raised “Very strong Baptist. Sunday school every
Sunday,” made this observation: “A strong influence on me, and I think on a
lot of SETI people, was the extensive exposure to fundamentalist religion. You
find when you talk to people who have been active in SETI that there seems to
be that thread. They were either exposed or bombarded with fundamentalist
religion. So to some extent it is a reaction to firm religious upbringing”.
Similarly, John Kraus recalled: “We were very strong churchgoers, members of
the Methodist church. I was brought up in a very religious atmosphere…there
was never any thought of conflict between science and religion in my thinking
or in my upbringing. Science and religion were simply both seeking ultimate
truth but using different ways of going at it”. ...

... One might speculate that SETI, as a highbrow, elitist revolution, contains
within it quasi-religious and spiritual overtones, in the sense that these
scientists, while not believing in God, do believe in ETIs, uniformly
portrayed as higher intelligences who, having survived what might be a
tendency in species toward self-destruction once advanced technologies are
created, must also be morally superior. To the extent that religion involves
belief in and hope for transcendence or transcendent beings, SETI is a high-
cultural form of religion, and UFOs a low-cultural form of religion.

 _The Measure Of A Life: Carl Sagan and the Science of Biography_
[http://www.theeway.com/skepticc/newsworthy06.html](http://www.theeway.com/skepticc/newsworthy06.html)

P.S. I was very much a child of Sagan and SETI! I was 15 when _Cosmos_ aired,
and read every Sagan book I could get my hands on, got a large telescope,
became obsessed with astronomy for years... Reading about this religious
dimension years later surprised me, it had never occurred to me. (My family
was atheist)

~~~
yesenadam
Also, if you loved (Sagan's) _Cosmos_ \- Dimitri Martin did a spoof version,
_Our Fascinating Planet_ , which is absolutely hilarious.

[https://www.youtube.com/watch?v=fYo-
OdQ-5ic&list=PLRcB4n4CGc...](https://www.youtube.com/watch?v=fYo-
OdQ-5ic&list=PLRcB4n4CGcy8OG9eFOjCyZgooBirO-q8G)

------
nayuki
Reminds me of this classic number:
[https://en.wikipedia.org/wiki/Illegal_prime](https://en.wikipedia.org/wiki/Illegal_prime)

Basically: DeCSS source code (illegal) → compress → pad → add constant to make
it prime.

~~~
lonelappde
That article talks about specious attempt to hack the legal system, by
claiming information can never be legally restricted because it can encode
numbers, but doesn't say the result of the attempt.

~~~
cyborgx7
Copyright does make numbers illegal. I think it is less about "hacking" the
legal system, and more about demonstrating how nonsensical it is.

~~~
dTal
Which it doesn't actually do. Whatever you think of copyright law, the
nonsense lies in our contradictory intuition that information is "special" and
numbers, even large ones, aren't. But beyond about, oh say, 128 bits[1],
numbers take on all the properties we expect of "special" information.

I can, for instance, encode a picture of you doing something embarrassing as a
very large prime[2] number. Yet my protest of "it's just a prime number, bro!"
isn't likely to calm you when I start passing it around to all your friends.
Information is information. It's not unreasonable to have rules about the flow
of information, however cleverly you've encoded it.

[1] [https://qntm.org/number](https://qntm.org/number) [2] The primality is of
course totally irrelevant, but it makes it seem more "mathy"

------
uyaij
Explanation from an article referenced by the linked article[1]:

Most of the digits were fixed while the rest could be brute-forced using some
useful properties.

[1] [https://www.futilitycloset.com/2017/09/10/trinity-hall-
prime...](https://www.futilitycloset.com/2017/09/10/trinity-hall-prime/)

~~~
kijin
From the link:

> approximately one in every 6200 2688-digit numbers is prime.

So if you're lucky, you only need to brute force the last 4 digits! Maybe 5 if
you're unlucky. In either case, that's a lot less work than I imagined. And of
course you can skip all the even numbers.

~~~
krackers
How did you get 4 digits? Wouldn't that mean 1 in every 2^4 = 16 is prime? For
1 in every 6200 shouldn't it be 12 digits?

~~~
thedufer
I think the confusion here is that the first image is generated by rendering a
prime in binary. The rest appear to be decimal, though, which leads to the
result of 4 digits.

------
kff55
You can generate these from any image here:
[https://geonnave.github.io/primg/](https://geonnave.github.io/primg/)

~~~
miguelmota
Pretty cool although it struggled with certain very basic 2d images.

------
rmeertens
Half a year ago I made the same idea but with colour:
[http://www.pinchofintelligence.com/painting-by-prime-
number/](http://www.pinchofintelligence.com/painting-by-prime-number/). It's
interesting that we both took the Mona Lisa to visualise the concept :)

------
lonelappde
This is yet another case where "prime" is bolted onto something for no
particular reason to make it superficially more interesting. IMO this confused
mathematical understanding.

Approximately 1/n of all n-bit pieces of data (including bimaps) are prime.

~~~
mc3
It's like a magic trick. Amazing at first, then you sort of realize how they
did it.

------
dmurray
I was sure that the original inspiration for this would be this [0] comic and
reddit post from 2015, about a 4096-bit prime number that looks like a giraffe
[1].

[0]
[https://www.reddit.com/r/math/comments/7qpfls/does_there_exi...](https://www.reddit.com/r/math/comments/7qpfls/does_there_exist_a_prime_number_whose/)

[1] A reddit commenter also found a "minimalist giraffe": 7.

~~~
Agentlien
That comic was oddly apropros. I just messaged my father explaining what a
perfect number is (He'd asked me because of a question on a game show). That
comic made for a great footnote.

------
mkl
We discussed a similar thing a couple of years ago:
[https://news.ycombinator.com/item?id=16192608](https://news.ycombinator.com/item?id=16192608)

Here's a prime smiley face (with code) I generated at the time:
[https://news.ycombinator.com/item?id=16192922](https://news.ycombinator.com/item?id=16192922)

------
extr
Wow. I feel like the fact that you can encoding arbitrary information in long
numbers is such a far reaching concept in math/computer science, it's really
satisfying to see it demonstrated in such an intuitive way.

~~~
ShorsHammer
The entire Library of Babel is encoded in Pi.

[https://en.wikipedia.org/wiki/The_Library_of_Babel](https://en.wikipedia.org/wiki/The_Library_of_Babel)

~~~
ConcernedCoder
So cool, you can find anything you search for:
[https://libraryofbabel.info/bookmark.cgi?concernedcoder0001](https://libraryofbabel.info/bookmark.cgi?concernedcoder0001)
about 1/2 way down the page you can find: "concerned coder is a programmer
living in the sourthern usa, playing a game called eve online while reading
hacker news on a sunday night in january"

~~~
twic
Hmm. Other sources suggest that Concerned Coder is a programmer living in the
_northern_ USA, playing a game called Eve Online while reading Hacker News on
a Sunday night in January:

[https://libraryofbabel.info/bookmark.cgi?concernedcoder00001...](https://libraryofbabel.info/bookmark.cgi?concernedcoder00001:1)

------
war1025
Semi-related, but reading this article and thinking about it made me wonder if
there is any study at all of "gray code" primes, for lack of a better word.

Basically, prime numbers that differ by exactly one binary digit in their
representation.

Probably nothing about that relationship that would be interesting enough to
look into beyond just "I ran some calculations and found these numbers that
fit the pattern"

~~~
oefrha
This is just a weaker version of the twin prime conjecture. You’re asking for
primes that differ by 2^k instead of 2. Last I heard the best result was from
Polymath 8a.

[http://michaelnielsen.org/polymath1/index.php?title=Bounded_...](http://michaelnielsen.org/polymath1/index.php?title=Bounded_gaps_between_primes)

Edit: Actually I was wrong, differing by a binary digit is much stronger than
a difference of 2^k. But that’s a starting point.

~~~
war1025
Neat. Thanks for tying it in to something real. Makes sense now that you
phrase it that way. Not something I've ever looked into much.

~~~
oefrha
Actually I replied without thinking too much, sorry... Your question is
(probably a fair bit) stronger than the one I related to. Edited.

~~~
chairmanwow1
Big side note, but what you just exhibited is one of my favorite things about
this community: admitting being wrong.

It wasn’t really until the workplace where I encountered level-headed people
that would just shrug their shoulders and say “You are right. I was wrong” and
then move on.

It’s so simple, but is amazingly powerful.

------
Causality1
Reminds me of a thought I had a while back that given sufficient computational
power you could describe any dataset using only two place values in an
irrational number and an interpretation rule. For example, the complete data
for an h265 copy of Avengers Endgame exists somewhere in the digital
expression of the value of Pi. It might be googleplexes of digits deep, but
it's there somewhere.

~~~
Nition
The problem is that the index itself becomes so large, even you use a dataset-
optimised number instead of pi, that it's much worse than just storing the
original data.

~~~
Causality1
Oh certainly. I was just thinking of it as a way to get around intellectual
property laws.

------
amelius
And a prime number showing Mickey Mouse? Or is it illegal because copyright?

~~~
DannyB2
With Mickey Mouse the issue is more likely trademark rather than copyright.

------
tealpod
Usecase: In future when computers become intelligent and we(humans) want to
communicate without computers understand, we can use this means :)

------
nailer
This would make a great conspiracy theory - that Mona Lisa was a prime number
painted by Leonardo.

------
pietroppeter
what if instead we have an approximate representation of an image through a
highly composed number? we end up with a number theoretic compression
technique.

------
tus88
How on earth did they verify a 30k long number is prime?!?

~~~
peteretep
Perl's regex engine is really fast, so presumably:

    
    
        perl -lne '(1x$_) =~ /^1?$|^(11+?)\1+$/ || print "$_ is prime"'

~~~
saagarjha
For the curious: [https://www.pixelstech.net/article/1324906920-A-Perl-
Regular...](https://www.pixelstech.net/article/1324906920-A-Perl-Regular-
Expression-That-Matches-Prime-Numbers)

------
aj7
What are the image errors?

