in reply to Re: Re: Square Root algorithm
in thread Square Root algorithm

I remeber for One funny alogorith for fined square root from some numbers :-)

add together odd-numbers from 1 while total sum is greater or equal to input number :-). Count of numbers is root :-))

exam.
root from 9 : 1+3+5=9 number 3
root from 25 : 1+3+5+7+9=25 number 5
root from 100: 1+3+5+7+9+11+13+15+17+19=100 number 10 :-)
easy and funny but works :-)
It's usefull for locating starting number for iteration process.

This algorithm is very fast because use only adding and testing :-)
but today it's irelevant becuase processor are very fast and using math-coprocessor :-).

several years ago thas was easy to creat it for lots of ASM instructions :-))

Replies are listed 'Best First'.
Re: Re: Re: Re: Square Root algorithm
by ariels (Curate) on Jun 26, 2001 at 14:39 UTC
    (<var>n</var>+1)2-<var>n</var>2 = 2<var>n</var>+1. </blockquote

    So your algorithm works for any square integer. But it's not very fast, as it takes time proportional to O(sqrt(<var>n</var>)), where <var>n</var> is the number you're rooting, not its size!

    For comparison, Newton-Raphson / the Babylonian algorithm double the number of correct digits at each iteration.

Re: Square Root algorithm
by Anonymous Monk on Dec 02, 2001 at 13:03 UTC
    Moin,

    by mamut on Jun 25, 2001 at 21:07 I remeber for One funny alogorith for fined square root from some numbers :-)

    Cool! ;o) I am currently optimizing the square-root in BigFloat/BigInt, that might come in handy!

    Cheers, Tels (at bloodgate dot com)