Print out the number of primes between 2 and 40,000.
Print the number of primes between 10,000 and 20,000.
Print all the primes from 200 to 400, 10 primes per line.
Print the value of the greatest prime less than 10,000.
Print the value of the greatest prime less than 40,000.
Print the value of the greatest prime less an integer supplied by the user and verified to be in the range [10,000, 39,999].
Yes, this is for my last computer programming assignment...I just don't know how to start at all
hey buddy...yea, would it bother you to not give an answer that comes off as a little snarky. All I was asking was how I would approach this little predicament I'm in or could give me a rough outline
Here's an overly complicated version I made once (I guess it's ok to post sieve code cause you can practically find it everywhere... and nobody would believe anyone who'd seriously enter this as an homework answer anyways - also not that it is, strictly speaking, not actually the sieve of Eratosthenes, although the basic idea is similar enough):
DISCLAIMER: NO WARRANTIES REGARDING QUALITY OR GENERAL USEFULNESS OF FOLLOWING CODE ARE MADE. USE AT OWN DISCRETION.
file "test" => ["sieve.o","test.c"] do
sh "gcc -Wall -pedantic-errors -std=c1x -O3 -s test.c sieve.o -o test"
end
file "sieve.o" => ["sieve.h","sieve.c"] do
sh "gcc -Wall -pedantic-errors -std=c1x -O3 -s -c sieve.c"
end
task :default => ["test"] do
end
task :rebuild => [] do
Rake::Task["sieve.o"].execute
Rake::Task["test"].execute
end