Ok
removed code
Note that I have tested the program on many intervals. For instance it gives 4832 between 999900000 and 1000000000 - which should be correct according to this forum. I also tried more intervals in one run - again correct answers. I tried both small and big primes. I verified the big primes using prime-numbers.org. I also tried intervals, which started and/or ended with primes.
Any help will be highly appreciated.
I've got one suggestion - if I may. It might be a good idea to provide a test case for such a problems. I understand, that you can't provide us with the same test you use to verify the correctness. But you could provide us with a different test case with similar complexity - so, if the program passes this test case, it's highly probable, that it also passes the "ultimate" tests.