Programming Thread

Viewing single post

Started by the-pi-guy, Mar 13, 2016, 10:39 PM

previous topic - next topic

the-pi-guy

Oct 13, 2018, 02:57 PM Last Edit: Oct 13, 2018, 03:24 PM by the-pi-guy
That's really nice. If it was ever so slightly slower, you'd feel like you did something wrong.
I actually sat down and did the math to see about how long it should take, assuming everything was working properly. 

Was well in line with what was happening. 

How did you handle memory for that? An array with 250,000,000 entries feels like it could have issues if just used willy nilly.
I just used an array. 

250,000,000 ints requires about 1 GB of space. 

(It's very good to have 16 GB of RAM).

I basically had a function like
Code: [Select]

f(N){
for( i=0; i<=N; i++)
array[i] = calculate(i);
}

Where calculate just calculates the number. 

All the previous calculations have to be accessible for the calculate function.