# less_retarded_wiki

main page, file list, single page HTML, source, report, wiki last updated on 06/07/23

# Exercises

Here let be listed exercises for the readers of the wiki. You can allow yourself to as many helpers and resources as you find challenging: with each problem you should either find out you know the solution or learn something new while solving it.

Problems in each category should follow from easiest to most difficult. The listed solutions may not be the only possible solutions, just one of them.

## General Knowledge

- What is the difference between free software and open source?

### Solutions

- The free software and open source movements are technically very similar but extremely different in spirit, i.e. while most free software licenses are also open source and vice versa (with small exceptions such as CC0), free software is fundamentally about pursuing user freedom and ethics while open source is a later capitalist fork of free software that removes talk about ethics, aims to exploit free licenses for the benefit of business and is therefore unethical.

## Programming

- Write a C program that prints out all prime numbers under 1000 as well as the total count of these prime numbers.

### Solutions

1:

```
// Sieve of Eratosthenes algorithm, one possible way to generate prime numbers
#include <stdio.h>
#define N 1000
char primeMap[N];
int main(void)
{
int primeCount = 0;
for (int i = 0; i < N; ++i)
primeMap[i] = 1;
for (int i = 2; i < N; ++i)
{
if (primeMap[i])
{
primeCount++;
printf("%d\n",i);
}
int j = i;
while (1) // mark all multiples of i non-primes
{
j += i;
if (j >= N)
break;
primeMap[j] = 0; // can't be a prime
}
}
printf("prime count under %d: %d\n",N,primeCount);
return 0;
}
```

## Math

### Solutions

All content available under CC0 1.0 (public domain). Send comments and corrections to drummyfish at disroot dot org.