04-20-2023, 04:08 AM
Challenge for you...
|
I've looked at this on You Tube, sieving is way way way faster!
But of course, the point is there IS a formula for primes Not whether it's very practical or not.
b = b + ...
(04-20-2023, 02:02 PM)bplus Wrote: I've looked at this on You Tube, sieving is way way way faster! Also requires a lot of memory. Although my program doesn't indicate it very well. https://staging.qb64phoenix.com/showthread.php?tid=1536 To begin with I actually used one of Freebasic's example programs which was Eratosthenes' sieve. It was a bit complicated, but my implementation was an array of bits, which was still quite large to get to a target of 100 billion. This was although all even numbers after 2 were excluded, and the first member of the bit array represented 3, the next 5, the one after 7 and so on.
The giant factorials don't scare me now that I have String math I can do them all day. It's the power stuff that hangs me up.
b = b + ...
04-20-2023, 05:07 PM
no chance to produce 100 primes with that lame formula unless you use bignum
here are the first 6 primes Code: (Select All) Dim As Long i (04-20-2023, 05:07 PM)Jack Wrote: here are the first 6 primes Give us 94 more. I could have sworn I wrote it down before: The book by PC Magazine author N.J. Rubenking about power-user programming in Turbo Pascal, which I had during the 1990's, contains an utility example of using the "string" type to compute arithmetic. Problem was that "string" type was able to hold only 255 characters. It was enough to hold 52! which the author wrote out on its wholesome in an earlier chapter of the book. I don't think he used any "in-house ASM" for it. He had written a separate "machine language" version of that utility though. So bplus would still have to start the engine for the "string math" to get as high as 99!, saying that because I saw the (j-1)! somewhere in the originally-written formula.
04-20-2023, 06:32 PM
Code: (Select All) n = 2
Here is 500! curtesy of bplus string math
500! = 1220136825991110068701238785423046926253574342803192842192413588385845373153881997605496447502203281863013616477148203584163378722078177200480785205159329285477907571939330603772960859086270429174547882424912726344305670173270769461062802310452644218878789465754777149863494367781037644274033827365397471386477878495438489595537537990423241061271326984327745715546309977202781014561081188373709531016356324432987029563896628911658974769572087926928871281780070265174507768410719624390394322536422605234945850129918571501248706961568141625359056693423813008856249246891564126775654481886506593847951775360894005745238940335798476363944905313062323749066445048824665075946735862074637925184200459369692981022263971952597190945217823331756934581508552332820762820023402626907898342451712006207714640979456116127629145951237229913340169552363850942885592018727433795173014586357570828355780158735432768888680120399882384702151467605445407663535984174430480128938313896881639487469658817504506926365338175055478128640000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 1143 digits minus first 7 = 1136 (everything right of the space after = sign)
b = b + ...
04-20-2023, 07:33 PM
Are we now talking about prime numbers, or about the factorial?
(04-20-2023, 07:33 PM)Kernelpanic Wrote: Are we now talking about prime numbers, or about the factorial? The challenge was to compute the prime numbers involving factorial because it was in a formula that was presented in the first post. Petr presented code which doesn't conform but does produce the first 100 primes. (04-20-2023, 06:34 PM)bplus Wrote: Here is 500! curtesy of bplus string math Involve the "string math" into the formula presented in the first post, because that's the challenge. |
« Next Oldest | Next Newest »
|
Users browsing this thread: 41 Guest(s)