File: erat.5c

package info (click to toggle)
nickle 2.70-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 2,324 kB
  • ctags: 3,324
  • sloc: ansic: 31,410; yacc: 1,864; sh: 954; lex: 858; makefile: 238
file content (15 lines) | stat: -rw-r--r-- 358 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/*
 * Copyright © 2002  Bart Massey.
 * All Rights Reserved.  See the file COPYING in this directory
 * for licensing information.
 */
bool[*] make_sieve(int size) {
  bool[size] sieve = {true ...};
  for (int k = 2; k < size; k++) {
    if (!sieve[k])
      continue;
    for (int i = 2 * k; i < size; i += k)
      sieve[i] = false;
  }
  return sieve;
}