[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]

>job interview >white board walks in >sum all primes

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: 11
Thread images: 1

File: iu.jpg (601KB, 1000x667px) Image search: [Google]
iu.jpg
601KB, 1000x667px
>job interview
>white board walks in
>sum all primes to 2 million
>back to the drawing board
>>
sigma notation you insufferable meme spouting brainlet
>>
>>8809339
>define "sum all primes to 2 million" as shitting on the white board
>please my primate ancestors
>>
>>8809339
>loop through all numbers 1 to 2 mil
>loop inside first loop dividing number by previous numbers except 1
>if only divisible by 1, add number to sum vector
>sum all the numbers inside the sum vector
>????
>profit

come on dude, I'm not even a programmer and I can do dat shit
>>
>>8809368
>>8809445
What is overflow
>>
>>8809455
>write a program that counts down from 2 trillion (2e12 = 2e6 * (2e6 - 1) / 2)
>one of the numbers must be the answer

long long int are at least 64 bits
2^64 = 1.8e19 (you'll want unsigned)
>>
"Tell Pajet to do it"
>>
>>8809339
Newfag here, is this supposed to be /sci/'s meme or something?
>>
>>8809714
it's the retarded offspring of /g/ and /sci/
>>
>>8809445

if you're going to brute force it you should probably instantiate an extra array where you store all previously found primes and just iterate through that as the divisor. also skip over all even numbers.

I'm a python programmer so something like:

found = [2]


for i in range(3,2000000,2):
k=0
for j in found:
if i%j==0:
k=1
break
if k = 0:
found.append(i)

print(sum(found))
>>
>>8811052

damn, it fucked up all of my formatting :(
Thread posts: 11
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.