![]() |
|
|
#1 |
|
1976 Toyota Corona years forever!
"Wayne"
Nov 2006
Saskatchewan, Canada
22×7×167 Posts |
Odd to me anyway ... some of you may be familiar with it or why it works.
http://pullmoll.stop1984.com/sqrt.html |
|
|
|
|
|
#2 | ||
|
Feb 2007
6608 Posts |
Quote:
Quote:
|
||
|
|
|
|
|
#3 |
|
1976 Toyota Corona years forever!
"Wayne"
Nov 2006
Saskatchewan, Canada
22×7×167 Posts |
Yes I did in fact read that but didn't take enough time to absorb how that extends to the algorithm he describes.
For example to calculate sqrt(1024) only requires adding 1+3+5 and later 61+63, rather than all odds from 1 to 63. (1+3+5) * 100 = 900 = sum of odds to 60. Cool... As I continue to investigate it starts to make sense .... so let me at it for a while and I'll be fine. Thanks |
|
|
|
|
|
#4 |
|
Nov 2005
2·7·13 Posts |
Do I understand right? That this is based on this formula for quadratics:
(n+1)^2=n^2+2n+1; let m=n+1 m^2-n^2-1=2n Thus consecutive squares are always 2n+1 appart. That formule you mentioned is equivilent to this code: Code:
Let x = 0 For i = 1 to n x = x + i + i - 1 Next i REM Returns in x, the square of n using recursive addition instead of multiplication. Code:
Let x=0 For i = 1 to n x = x + i + i Next i x = x - n Let x = 2 * n * (n + 1) / 2 - n Or: Code:
Let x = n * (n + 1) - n Code:
Let x = n^2 + n - n EDIT: You should note that for m=n+1: m^3 - n^3 - 1 = (n+1)^3 - n^3 - 1 = n^3 + 3n^2 + 3n + 1 - n^3 - 1 = 3(n^2 + n) = 3n(n+1) Last fiddled with by nibble4bits on 2008-03-15 at 07:44 Reason: Added note |
|
|
|
![]() |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Aouessare-El Haddouchi-Essaaidi "test": "if Mp has no factor, it is prime!" | wildrabbitt | Miscellaneous Math | 11 | 2015-03-06 08:17 |
| Primo quit with "Candidate is presumably a square" | lavalamp | Software | 12 | 2011-06-09 19:27 |
| Fastest possible algorithm to calculate the square root of a 10,000,000 digit number | Fusion_power | Math | 19 | 2007-11-02 21:37 |
| Would Minimizing "iterations between results file" may reveal "is not prime" earlier? | nitai1999 | Software | 7 | 2004-08-26 18:12 |