Live data from Hacker News

Using prime numbers to make better backgrounds

designfestival.com

41–50 of 57 posts

Re: Using prime numbers to make better backgrounds

#41

Wow, very impressive! I will definitely be trying this out. It reminded me of my discrete mathematics class, so now I'm wondering if there are any other cool principles that can be applied to design

Fair point, it's really basic combinatorics but well applied and properly executed.

And number theory.

Re: Using prime numbers to make better backgrounds

#42
post #21

This is very well explained, but not all that novel. Brian Eno used to generate long soundscapes like this, using loops of mutually prime lengths of time. Edit: See also - http://en.wikipedia.org/wiki/Ambient_1:_Music_for_Airports http://en.wikipedia.org/wiki/Generative_music

It also is the core of "method ringing", a kind of bell ringing from the 17th century and persisting today. Imagine some folks clanging away at 10 bells in a church tower for hours on end, never repeating, and never developing a melody. Each person is operating a single bell and repeating their pattern with a unique period. http://en.wikipedia.org/wiki/Change_ringing

Ringing the changes uses permutations. The described method uses relatively prime numbers.

Both produce music according to a simple algorithm, but the algorithms are different.

Re: Using prime numbers to make better backgrounds

#43
post #27

Earlier quoted context omitted.

Hah, that trumps my example by 200 years. Well done.

Except for the small detail that it isn't true. In change ringing, what you do is to cycle through some subset of the permutations of N bells. So you might begin 123456 123465 124365 and so on. The whole thing is made up of blocks of N bells in each of which each bell is rung once. Therefore, all bells have (on average) the same period: one ring, on average, out of every N. The bells are hung in such a way that they…

But each individual in method ringing is repeating their pattern. (at least as Wikipedia explains it.)

Re: Using prime numbers to make better backgrounds

#44
post #40
post #10

I won't get a chance to write this up, but in a similar vein, if you split the grain/texture off of an image, you can scale and stretch the image as needed, then drop a fairly small, tiled grain texture back on top. I think it is nicer to do two grain textures, one for lighter and one for darker. Make the grain image be solid white or black and put the grain in the alpha channel.

Hey guys, I actually mocked up a woodgrain test page while I was developing the article but I ended up preferring the lego and curtain examples. But if your interested: http://www.sitepoint.com/examples/primes/woodgrain.html It's not bad, but I don't think it's killer yet. I've got a very raw maze generation example somewhere if anyone's interested.

This is HN. Almost everyone's interested, so post away!

Re: Using prime numbers to make better backgrounds

#45
post #5

Cool, but these numbers don't have to be primes. They just have to be coprimes (like (8,9)). The least common multiple of two coprimes 'a' and 'b' is a*b. http://en.wikipedia.org/wiki/Coprime

Not for the cicada example, but yes for the web aspect. In the cicada example the point is that one predator would evolve to align its boom cycle so that it had a common divisor with the cycle of the cicada. Since the predator's cycle is variable, it is evolutionarily optimal if the cicada only comes out every prime number of years.

It's interesting that the cicadas have the cycles they do. Why not also go 23, 29, etc? There's obviously a trade off between being more frequent but also encountering more predators - I'm just curious why they settled on the cycles that they did.

Re: Using prime numbers to make better backgrounds

#46

This is the perfect Hacker News article. I learned something new and mathematically-interesting about the natural world, the author came up with a clever hack to enliven backgrounds, and we learn how to apply that to improve our own designs.

Totally agree. There have been quite a few articles recently that fall into this category. pquerna's recent post about OpenSSL memory in node (and elsewhere) is another that comes to mind. http://news.ycombinator.com/item?id=2411144 keep 'em coming I say!

It's interesting that it's almost impossible to pin down a verbal guideline for what people should be submitting (besides "anything that gratifies one's intellectual curiosity") but pretty easy to point to a given article and say that, yes, this definitely is Hacker News.

It'd be pretty awesome if we could have an HN that's just this sort of stuff (with a strong tendency toward false-negatives vs. false-positives—i.e. no "maybe good", only "definitely good.") I wouldn't mind even if it only had two or three new posts per day—fewer, guaranteed posts means I could actually stand to add it to my RSS reader, vs. the current HN which is more of a firehose: good to stick a bottle in every once in a while, not good to stand in front of.

Thinking on that, here's one way it could be implemented on top of the current HN: if there was some sort of "way, way up"-vote button that (besides being an actual "I wish I had N upvotes to give this" upvote-N-times button) worked as a sort of moral negative to flagging, such that when it had been hit [some threshold] times for an article, the article would get linked into the "/awesome" sublist, that might be enough to make it happen—if we trust the userbase to not abuse it.

If everyone started to way-way-up-vote everything they currently just up-vote, perhaps one could stick a CAPTCHA (or three) on it to make it just annoying enough to disuade abuse (at the cost of further false negatives from people now too lazy to use it.)

Re: Using prime numbers to make better backgrounds

#48
post #46

Earlier quoted context omitted.

Totally agree. There have been quite a few articles recently that fall into this category. pquerna's recent post about OpenSSL memory in node (and elsewhere) is another that comes to mind. http://news.ycombinator.com/item?id=2411144 keep 'em coming I say!

It's interesting that it's almost impossible to pin down a verbal guideline for what people should be submitting (besides "anything that gratifies one's intellectual curiosity") but pretty easy to point to a given article and say that, yes, this definitely is Hacker News. It'd be pretty awesome if we could have an HN that's just this sort of stuff (with a strong tendency toward false-negatives vs. false-positives—i.e…

You can filter the homepage for submissions with a minimum number of votes:

http://news.ycombinator.com/over?points=200

HN has loads of hidden features. I suggest judicious use of google's search operators to find them all.

Re: Using prime numbers to make better backgrounds

#49
post #37

Earlier quoted context omitted.

Consider, though, that these groups of cicadas don't really "care" about one another from a genetic standpoint. If the broods don't interact, they're basically different sets of genes that only interact via mutations, so the principle still holds. What's interesting about that is how the broods might diverge to coprime emergence schedules to prevent competition.

Well, they do care. The idea is to starve out predators. If there is another set of cicadas feeding them, then it doesn't work for just you to avoid them.

KirinDave's point is that there is no "idea." If the groups are disjoint, there's no conspiracy, no way for them to interact with each other. If you and your group avoid the predators, then you will thrive. It doesn't matter that another group does not. Evolution happens at the level of genes, not groups.

Re: Using prime numbers to make better backgrounds

#50

Earlier quoted context omitted.

Not for the cicada example, but yes for the web aspect. In the cicada example the point is that one predator would evolve to align its boom cycle so that it had a common divisor with the cycle of the cicada. Since the predator's cycle is variable, it is evolutionarily optimal if the cicada only comes out every prime number of years.

It's interesting that the cicadas have the cycles they do. Why not also go 23, 29, etc? There's obviously a trade off between being more frequent but also encountering more predators - I'm just curious why they settled on the cycles that they did.

They only mate once before dying. I assume waiting 29 years would increase the odds of a pre-mating death. Maybe even death from old age. How long can an insect live?
Post reply on HN