Red - Chapter 2

Chapter 2 exercises for Java Training.
Came up with this sieved variation when trying to do it faster (it's actually a lot slower for large primes, because of the allocation cost, perhaps a mark and sweep method would be better?):

```java
final int limit = 1_000_000;
		
List<Integer> primes = new LinkedList<Integer>();
LinkedHashSet<Integer> range = new LinkedHashSet<Integer>();
range.add(2);
for( int i = 3; i < limit && range.add(i); i += 2 );
		
for( int p, i; range.size() > 0; range.remove(p), primes.add(p) )
  for( p = range.iterator().next(), i = p * p; i <= limit; range.remove(i), i += p );
		
primes.forEach(System.out::println);
```