Diferente pentru ciurul-lui-eratostene intre reviziile #8 si #9

Nu exista diferente intre titluri.

Diferente intre continut:

    for (i = 1; (i << 1) + 1 <= n; i += 1) {
      if (p[i] == 0) {
        nr++;
        for (j = i + i + i + 1;
 
               (j << 1) + 1 <= n;
 
                  j += (i << 1) + 1) {
        for (j = i + i + i + 1; (j << 1) + 1 <= n; j += (i << 1) + 1) {
          p[j] = 1;
        }
      }
      }
    }
    for (i=1; 2 * i + 1 <= n; ++i)
 
        if (p[i] == 0) nr++;
    return nr;
  }
  public int getTheNumber(int n) {
    int i, j, nr = 1;
    for (i = 1;
 
         ((i * i) << 1) + (i << 1) <= n;
 
          i += 1) {
    for (i = 1; ((i * i) << 1) + (i << 1) <= n; i += 1) {
      if ((p[i >> 3] & (1 << (i & 7))) == 0) {
        for (j = ((i * i) << 1) + (i << 1);
 
              (j << 1) + 1 <= n;
 
               j += (i << 1) + 1) {
        for (j = ((i * i) << 1) + (i << 1); (j << 1) + 1 <= n; j += (i << 1) + 1) {
          p[j >> 3] |= (1 << (j & 7));
        }
      }
    }
    for (i = 1; 2 * i + 1 <= n; ++i)
 
         if ((p[i >> 3] & (1 << (i & 7))) == 0)
 
             nr++;
    return nr;
  }

Nu exista diferente intre securitate.

Topicul de forum nu a fost schimbat.