Hey guys!
So guys, I was compiling a program in my BlueJ, where I had to make a loop from 2 to 10^15, and I come across this error-
-Warnings from last Compilation
Some messages have been simplified, recompile with -Xdiags:Verbose to receive full output
Its indeed, not showing the full output.
My code was simple one, I wanted to print all prime numbers in between 2 to 10^15. But its giving an error in for loop that “integer is too large”
So yeah, any idea how I can fix these two errors? MAke the for loop run AND get full output? Will appreciate it, thanks!!
EDIT 1 -
At this point guys, I am also interested to know what this error is, and what it means by saying that “recompile with -Xdiags:Verbose to receive full output” and how do I do it.
Its a unusual warning in BlueJ, and so google didn’t help.
What is the complexity of your program? And what is the minimum time given of that particular question?
1 Like
Loop from 2 to 10^{15} will take a lot of time, and will not terminate for days.
Maybe BlueJ wants to say that 10^{15} is too large (which it is) or there might be overflow happening somewhere.
2 Likes
Complexity is O (N^2), but I doubt that this has anything to do with it.
No constraint as such. I need it for pre-computational purposes for another problem. Meaning, you get Q like “you are given q queries and for each query print the Kth Prime number” and these types, where pre computing the result, storing it in array and returning the value stored in Kth index makes program a cakewalk.
Clarification: I am running the program on my laptop, and that’s why it has no time constraints. The result of this program would be used for the online question (i.e. the question with constraints).
It DID prompt that 10^15 was too large…and I being the bad boy I am, I replaced 10^15 with Math.pow(10,15) and it complied…But yeah, overflow did happen and I switched to Big Integers, and now this compiler warning is driving me nuts
If it is your developed question then it would not be easy to calculate prime up to 10^{15} and after that querying it with O(1) time. First you must assure the possibility of framing a question by own.
Actually I did some research on what you said. Sadly yes, it will take lot of time for my pc to do this big iteration. Thanks for the answer, I will have to give up pre-computing approach for the problem.
BTW, if you come across anything regarding this error/warning, do let me know! I am curious about it
I see your point regarding the algo. Thanks for that dear!
But any idea about this error? I am curious about it. Like when BlueJ issues this error &etc. If you come across anything, do tell me!
I have not work yet on BlueJ so i can’t help in this case!