Posts: 508
Threads: 105
Joined: Jul 2022
Reputation:
22
I am closing this Challenge for the reason that it is unsolvable.
The formula is invalid and produces incorrect results.
Thanks for your time and effort.
Erik.
Posts: 490
Threads: 41
Joined: Apr 2022
Reputation:
40
04-21-2023, 02:44 AM
(This post was last modified: 04-21-2023, 01:27 PM by Jack.)
it's unsolvable not because the formula is wrong but because it's simply impractical, I am guessing that to compute 100 primes using the formula within our lifetime would take a very fast super computer, if it's even possible
Posts: 4,698
Threads: 222
Joined: Apr 2022
Reputation:
322
04-21-2023, 01:20 PM
(This post was last modified: 04-21-2023, 01:24 PM by bplus.)
(04-21-2023, 02:33 AM)eoredson Wrote: I am closing this Challenge for the reason that it is unsolvable.
The formula is invalid and produces incorrect results.
Thanks for your time and effort.
Erik.
No the formula is correct, we just don't have the precision to do the math in it with QB64 without some serious math library code.
And as Jack says, it still may take a super computer to make a calculation in our lifetime.
Like I said before, sieving is way, way, way faster!!!
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever
Posts: 104
Threads: 9
Joined: May 2022
Reputation:
3
04-21-2023, 01:49 PM
(This post was last modified: 04-21-2023, 01:50 PM by DANILIN.)
Write name of program in 1st line to copy & paste & save filename.bas
Insert program pictures: press print-screen-shot button
Open paint & Paste & Save as PNG
Add picture file to program topic
Russia looks world from future. Big data is peace data.
I never recommend anything & always write only about myself
Posts: 4,698
Threads: 222
Joined: Apr 2022
Reputation:
322
(04-21-2023, 02:18 PM)mnrvovrfc Wrote: Could this be doable in "string math"?
Code: (Select All)
double Fast_Pow(double a, double b) //fastpower originally developed by Martin Ankerl
{
int tmp = (*(1 + (int *)&a));
int tmp2 = (int)(b * (tmp - 1072632447) + 1072632447);
double p = 0.0;
*(1 + (int * )&p) = tmp2;
//p = p * a / 2.71828F ; failed attempt to auto correct the accuracy
return tmp;
}
from:
https://qb64phoenix.com/qb64wiki/index.p...#Fast_Math
EDIT: I was responding to bplus saying something about "power" function being difficult to implement if it involves fractions, is that right? But this function might not be a solution because it seems to force a cast from double-precision to same-size integer. That first statement is ugly. :/
That 2.71828F looks like e so doing powers with natural logarithm. That e does not look nearly precise enough for long digit math but maybe it doesn't need to be, I doubt it though. The rest of that code is Greek to me ;-))
My problem with powers is cutting down the digits to only significant amounts because my calc's use everything in multiplication, so keep multiplying long digits numbers and double their lengths in digits each time basically.
Still that crazy formula is summing long calculations and as the Prime number increases you expand on digits (more than? is that possible?) exponentially but you need more and more digits to get nice pretty integer answers.
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever