News for hackers. Stuff that matters.
Re:Computing primes with CSS by XCSme on Friday September 30, 2016 @06:22AM (#12611579)
You can do the same thing with pure HTML, just write `2,3,5,7,11,13...`. I am disappointed by the article, was expecting something with CSS `calc()`.
Re:Computing primes with CSS by startling on Friday September 30, 2016 @07:43AM (#12611869)
That's not similar, at all. This is actually removing multiples, as in the sieve of erastosthenes.
Re:Computing primes with CSS by rootlocus on Friday September 30, 2016 @10:24AM (#12612621)
It's missing a loop, and the primes are hardcoded into the source code (see the similarity?). You might be mislead by the fact that you also find 'span:nth-child(4n+8)' or 'span:nth-child(6n+12)' (which aren't primes) but those are redundant, and an efficient sieve would skip non primes.
Re:Computing primes with CSS by nedbat on Friday September 30, 2016 @01:46PM (#12613984)
Yes, they are redundant, but there's still no special knowledge of the primes in the file.
Re:Computing primes with CSS by startling on Friday September 30, 2016 @11:22PM (#12616396)
The primes are hardcoded into the source the same way that the primes are hardcoded into the sequence of natural numbers. They're there, but the important bit is finding them.
Re:Computing primes with CSS by nedbat on Friday September 30, 2016 @12:58PM (#12613642)
The point is that the file has nothing about the primes in it. 6 and 7 are treated equally, but 7 is displayed and 6 is not.
Re:Computing primes with CSS by rootlocus on Friday September 30, 2016 @01:42PM (#12613956)
The file has the first sqrt(1000) primes hardcoded in it.

If you wanted to find the first 100.000 prime numbers, you'd need to add all the prime numbers up to 313 in the css file.

Re:Computing primes with CSS by nedbat on Friday September 30, 2016 @01:45PM (#12613974)
You should look more closely: it doesn't. The CSS selectors are for 2, 3, 4, 5, 6, 7, 8, 9, ..., 32. The most you can say is that it has sqrt(1000) == 32 hardcoded into it, but there are no primes.
Re:Computing primes with CSS by rootlocus on Friday September 30, 2016 @01:53PM (#12614039)
Ok, I get it. However, you still need to modify the source code to accomodate for larger inputs.
Re:Computing primes with CSS by nedbat on Friday September 30, 2016 @02:36PM (#12614337)
True dat.