Sieve of Eratosthenes without arrays?
I have to write a java code for the 'sieve of eratosthenes' algorithm to print out primes up to a given max value on the console but I'm not allowed to use arrays. Our professor told us it is possible to do only with the help of loops. So I thought a lot and googled a lot about this topic and couldn't find an answer. I dont think it's possible at all because you have store the information which digits are already crossed out somewhere. my code until now: public static void main(String[] args) { int n = 100; int mark = 2; System.out.print("Primes from 1 to "+n+": 2, "); for (int i = 2; i <= n;