[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/sci/ - Science & Math


View post   

File: 3.44 MB, 4032x3024, IMG_1115.jpg [View same] [iqdb] [saucenao] [google]
8605574 No.8605574 [Reply] [Original]

Place your bets.

>> No.8605602

>>8605574
∑1/π(n) ~= ∫ln(x)/x ~= 215

>> No.8605630

>>8605574

I would programming using Sieve of Eratosthenes on Java.

I don't know matlab but your program will be more fast using this

https://www.mathworks.com/help/matlab/ref/primes.html?requestedDomain=www.mathworks.com

loop over primes list.

>> No.8605651

>>8605630

primes(n) creates a single array of the first n primes, which can get huge. So it's restricted by memory. MATLAB won't allow arguments past a certain value.

>> No.8605662

>>8605651 here
Slight correction: primes(n) creates an array of primes less than or equal to n. Still a single array, though.

>> No.8605801

>>8605602
yeah put that filthy normie in his place

>> No.8605947

>>8605602
definitely wrong kek

>> No.8605965

>>8605574
>using matlab
fucking why

python is free, easier, more forgiving, and has libraries that have anything you might need.

>> No.8605967

>>8605965
>doesn't use matlab
Lol pleb, do you even uni?

>> No.8605977

>>8605965
Because if I used python, some insufferable faggot would ask why I'm not using MATLAB.

>> No.8605990

>>8605967
i used matlab in undergrad because i was a lazy shithead like OP that didn't want to look into alternatives. python is even easier to use than matlab, has an interpreter, and is not as slow.

>> No.8606006

>>8605990
I'm tempted to do it in Excel now, just to make you squeal.

>> No.8606007

>>8606006
do it. i'll be surprised if it won't crash.

>> No.8606013

>>8606007
So would Bill Gates, I'm sure.

>> No.8606044

OP here. I doubt anyone's waiting on the edge of their seat for this, but if you are, I'd (very roughly) estimate seven more hours to finish. Could be a lot more, given the increasing intervals between primes... hell, depending on how the isprime function works, it could already be in an infinite loop.

If it's still going in twelve hours, I'll kill it and see what it got to.

>> No.8606095

i determined the result using a sieve of eratosthenes in C
3.4332861011375368

>>8606044
your program will never terminate

>> No.8606548

>>8606044
haven't been into programming lately but i think your inner while loop will never end

>> No.8606957

>>8605574
>>8606044
any news OP?

>> No.8606965

what is this software

>> No.8607003

>>8606044
The matlab isprime function is very fast (Miller-Rabin).

Just wanted to drop in and berate you for doing k=k+1 instead of k=k+2.

>> No.8607026

>>8607003
wew, OP you goofed

>> No.8607038

>>8605574
op never returns

>> No.8607040

>>8607003
>very fast (Miller-Rabin).
kek

>> No.8607044

>>8606095
interesting question, is the sum of the reciprocals of the primes expected to converge?

>> No.8607046

>>8607044
>interesting question, is the sum of the reciprocals of the primes expected to converge?
no, it is a divergent series
https://en.wikipedia.org/wiki/Divergence_of_the_sum_of_the_reciprocals_of_the_primes

>> No.8607050

>>8607046
thanks

>> No.8607051

>>8607003
>Just wanted to drop in and berate you for doing k=k+1 instead of k=k+2.
as if this makes any significant difference.
the complexity of testing a multiple of 2 is O(1)

testing every other number has a complexity of O(klog^3 n) (as per wikipedia)

so iterating over multiples of 2 produces a negligible extra cost

>> No.8607110

>>8605965
Pleb detected.

>> No.8607128

>>8606095
taking a look at this page https://en.wikipedia.org/wiki/Meissel%E2%80%93Mertens_constant
we get 3.433285778848619
which is 3x10^-7 less than your result
indeed, we should expect this to be lower as n < infinity

i'm betting >>8606095 will be a very precise estimate
(provided OP delivers)

>> No.8607146

>>8607040
explain

>> No.8607167

>>8607146
performing the algorithm 10^9 times is slow as fuck compared to using sieve of eratosthenes
https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test#Computational_complexity
https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes#Algorithmic_complexity

>> No.8607790

>>8606965
it's the less shitty version of GNU Octave

>> No.8608256

>>8606095
i ran the program using quad-precision floats this time to get
3.4332861011360211253759993728579925452503513520343194288703092984459640246708289623711607418954372406005859375

any news OP?