[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Rate my prime number generator /g/, I have job interview in

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 16
Thread images: 1

File: 1478882681437.jpg (38KB, 426x341px) Image search: [Google]
1478882681437.jpg
38KB, 426x341px
Rate my prime number generator /g/, I have job interview in few days and I would want to be able to get it.

https://github.com/Open96/PrimeNumberGenerator
>>
>>61492754
Mind explaining why you chose java for something computationally expensive?
>>
>>61493450

Because if you look at my github, I mainly use Java. I also know C++ to level where I can handle pointers and stuff but Java is just more appealing to me.

>inb4 pajeet language

I am native European
>>
>>61493649
Hello Pajeet
larping as a Cuck today I see
>>
I for one would not consider programming something like this in any language higher level than 65816 assembly.
>>
>Still, you can do it with my program (But I doubt you have enough RAM in your PC to do that).
Yeah, that must be a great program. Running out of RAM trying to find fucking prime numbers.
>>
>>61492754
You should trow an exception instead of returning -1 at prime count, common java practise.
>>
>>61493813
this
>>
What is the most memory-efficient way of generating all the primes up to, like OP says in the github, 9223372036854775807?
>>
>>61493837
Also, looks like the program only takes one input and then exits. Why not have a do while loop where the user can run many consecutive commands and add a case called "exit".

Also no reason not to instantiate the buffered reader before the try statement.
>>
>>61493990

OP here, this is literally what it does. Just check the main class. Relating BufferedReader - it kinda is needed to instantiate it if you want to use it.

>>61493958

https://en.wikipedia.org/wiki/Sieve_of_Atkin this is the best thing but also most complexx, thats what I heard. Second one is the one in my program (linear sieve) and then is the slowest Erastotenes' sieve.

>>61493813

Okay, then write me a program that stores that big amount of numbers in any language (protip, you can't). Also, it will run out of RAM at really large number anyways considering swap exists and people have 8gb+ RAM in current year. Also:
> what is solving mathematical problems
> writing useless programs for them
I bet you haven't seen what CS students actually do through their course.
>>
>>61494280
>I bet you haven't seen what CS students actually do through their course.
I'll admit I'm not familiar with the cancer current CS students write. I'm an electrical engineer and I'm used to writing software that actually does something useful. In my EE courses I also implemented a microprocessor with a custom instruction set on an FPGA that had kilobytes of memory space, not gigabytes or terabytes or whatever the fuck your sieve needs. Current year is a shitty excuse.
>>
>>61494854

>that had kilobytes of memory space

Well, mine does take 1 bit per number and I don't think I can get lower than that in Java. Considering chosen language it is quite efficient.

> Current year is a shitty excuse

Unused RAM is wasted RAM.
>>
>>61494983
>Unused RAM is wasted RAM.
The problem is, your sieve is literally running out of RAM.
>>
>>61495026

Yeah, at really fucking large numbers. Trust me, I tried to do it on HDD but accessing it byte by byte would take an eternity. Every sieve will run out of RAM eventually and I don't say mine is the best but I think it is fairly good approach to tackle the problem compared to normal sieve, especially when we are talking about Java.
>>
>>61495450
Just read wikipedia, fucktard.
Thread posts: 16
Thread images: 1


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.