Question: hi have a template with a form and many inputs that pass some data trough a POST request to a view, that process them and send the result to another template. in the final template, if i use the browser back button to jump to the first view, i can see again old data. i refresh the page and i insert new data, i submit again but some old data remain when i see the final view. the problem remain even if i restart the debug server. how can i prevent it? it seems that there's some data-caching that i can solve only flushing browser cache. this is the view code: <http://dpaste.com/640956/> and the first template code: <http://dpaste.com/640960/>

any idea?

tnx - luke

Answer: 
Here is my implementation.

```
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

int* sieve(int n) {
  int* A = calloc(n, sizeof(int));
  for(int i = 2; i < (int) sqrt(n); i++) {
    if (!A[i]) {
      for (int j = i*i; j < n; j+=i) {
        A[j] = 1;
      }
    }
  }
  return A;
}

```

I benchmarked it for the first 1,000,000,000 numbers on an i5 Kaby Lake.

```
 time ./sieve 1000000000
./sieve 1000000000  16.21s user 1.05s system 99% cpu 17.434 total

```

I simply translated [this](https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes#Algorithm_and_variants) pseudocode from Wikipedia.
Here was my implementation (Java)
much simpler in that you really only need one array, just start for loops at 2. 

edit: @cheesehead 's solution was probably better, i just read the description of the sieve and thought it would be a good thought exercise.

```
      // set max;
      int max = 100000000;

      // logic
      boolean[] marked = new boolean[max]; // all start as false
      for (int k = 2; k < max;) {
         for (int g = k * 2; g < max; g += k) {
            marked[g] = true;
         }
         k++;
         while (k < max && marked[k]) {
            k++;
         }
      }

      //print
      for (int k = 2; k < max; k++) {
         if (!marked[k]) {
            System.out.println(k);
         }
      }

```