To expand a little more on the efficiency comparison, while this is on the same time complexity scale as trial division, Fermat factoring is a bit more elegant. That said, the speed savings of the algorithm I proposed is that, asymptotically, one of the square roots computed is replaced by one...
Hey everybody, I thought I would share an algorithm for factoring that I designed a few years ago while working on a Z80 project. I noted the same thing Fermat must have:
a^{2}-b^{2}=(a+b)(a-b)
After a few moments of looking at it, I realized the translation of that simple expression: If I can...
I know, I should have been more clear by being more confusing :P I was using √ to represent the function that, given the output of f(x)=x2, would return x. When I was working on a little project dealing with sine and cosine, I would often have a function squared on one side, where the otherside...
I was debating on posting since my reply is programming oriented instead of math/physics)
I did not originally see that link (I just saw the other), so thanks! I tried implementing it in code, too, and it worked phenomenally. I managed to get it to work in an average of 545 clock cycles...
30! = 215+7+3+1310+3+156+17411213217*19*23*29=226314577411213217*19*23*29
Basically, for a given prime p<n, then at least floor(n/p) numbers are going to have p as a factor. Since they are multiplied, pfloor(n/p) is a factor. But then of those, an every p-th one of those numbers has an...
The division for my implementations takes about twice as long as a multiplication. Using a Taylor series would require >100 terms for the desired accuracy which is a lot of multiplications (even optimising it for arctangent to compute x2 once and not compute any more powers of x).
And that is...
The first line of your attempt is where you went wrong. e^{(x^{2})}\neq (e^{x})^{2}. Rather, (e^{x})^{2}=e^{x}e^{x}=e^{2x}
Otherwise, I kind of suck at this kind of problem. I never remembered all the fun rules, so I would go the really long route...
I get rather excited when my math is applicable to a physicsy situation, but generally my desire to do math stems from mostly non-linear thought processes and and other ramblings. My thoughts don't seem well suited for the focus required in other subjects. I am sure that if I had latched on to...
I won't try that, but I thought of this yesterday (breaking the same rule as above):
Start with:
\sqrt{x}
Now to factor out a -1:
=i\sqrt{-x}
And to factor out another -1:
=i*i\sqrt{x}
=-\sqrt{x}
\Rightarrow \sqrt{x}=-\sqrt{x}
:P The issue is that even functions are not 1-1...
Though it is nearly 8 weeks late, if you need only about 4 digits of accuracy, you could use tan^{-1}\approx \frac{x(240+115x^{2})}{240+195x^{2}+17x^{4}}, x\in [-1,1] and for x outside that range, use the identity tan^{-1}(x)=\frac{\pi}{2}-tan^{-1}(\frac{1}{x}). It might be a pain by hand, but...
I have posted this on other forums, and I have discussed this with my professors, but I thought I would share it here for those interested. Essentially, I have a function that efficiently approximates arctangent on [-1,1] and ln(1+x) on [0,1].
For some background about me, I am a Z80...