Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Root797775y
-
Just copy the value
Do
Decrease by one
Divide to original
if original mod copy =0 => return true
While (copy >2) -
I think the key hint for the third task is the data structure "dictionary" - somewhat unsurprisingly.
@melezorus34 Sounds like you need O(N) steps for that. If you try the other way around, i.e. divide by 2 and then by every odd number until SQRT(N), that would be much fewer steps. -
@melezorus34 That was my original approach but it still takes 2min per number...
-
@Fast-Nop I know how to do it i just didnt want to. That would use too much time to process that. I know i just could use a smaller set but it dosent matter now im going to pass and that is enough. Also i have plans for revenge.
-
@Gregozor2121 if you want, I can give you my compiled prank : mouse-ducker, with the source code cuz it ain't that complicated.
-
Avyy7495yPrime checking is easy. Use miller rabin or bpsw.
Since your number is small(10 digits), probability of false positives will be nearly zero. Just keep in mind miller rabin will need strong witnesses -
@AvyChanna That was supposed to be a introductory class to java, i dont want to bring out the big guns here.
-
@melezorus34 Sorry. I dont have any that i can post here. I will have to reject that offer. :(
Related Rants
-
hidd3ntrack22Happy April Fool's! - Windows 8 == Best OS - Apple is fairly priced - PHP > C++ - Java === JavaScript - faceb...
-
linuxxx8Manager (walking in in the morning): ey linuxxx, looking good today! Me: w-what? I'm not wearing much special,...
-
iSwimInTheC4Me: Did Sherry let you know that I'm leaving today? Coworker: what!? No! Me: yeah... I'm leaving. Coworker:...
I got pranked. I got pranked good.
My prof at my uni had given us an asigment to do in java for a class.
Easy peasy for me, it was only a formality...
First task was normal but...
The second one included making a random number csv gen with the lenght of at least 10 digits, a class for checking which numbers are a prime or not and a class that will check numbers from that cvs and create a new cvs with only primes in it. I have created the code and only when my fans have taken off like a jet i realised... I fucked up...
In that moment i realised that prime checking might... take a while..
There was a third task but i didnt do it for obvious reasons. He wanted us to download a test set of few text files and make a csv with freq of every word in that test set. The problem was... The test set was a set of 200 literature books...
rant
uni
remote learning
april fools