Hacker News new | ask | show | jobs
by gus_massa 3241 days ago
You can use the same trick dividing by all the numbers up to sqrt(n) [or n-1], instead of dividing by prime numbers.

You can replace

  li:first-child,
    li:nth-child(2n + 4),
    li:nth-child(3n + 6),
    li:nth-child(5n + 10),
    li:nth-child(7n + 14) {
      color: grey;
      counter-increment: nature-count nonprime-count;
    }
with

  li:first-child,
    li:nth-child(2n + 4),
    li:nth-child(3n + 6),
    li:nth-child(4n + 8),
    li:nth-child(5n + 10),
    li:nth-child(6n + 12),
    li:nth-child(7n + 14) 
    li:nth-child(8n + 16) 
    li:nth-child(9n + 18)
    li:nth-child(10n + 20) {
      color: grey;
      counter-increment: nature-count nonprime-count;
    }