The MASM Forum

General => The Campus => Topic started by: Mikl__ on April 22, 2015, 12:41:54 PM

Title: square roots and squaring without multiplication and division
Post by: Mikl__ on April 22, 2015, 12:41:54 PM
P.S. excuse me for my bad english, but I think you understood the idea
Title: Re: square roots and squaring without multiplication and division
Post by: Gunther on April 22, 2015, 05:13:10 PM
Hi Mikl__,

your idea looks at a first glance not so bad. Could you provide a paper with the formulae, please? You could write it with Latex or an office writer with a formula editor.

Gunther
Title: Re: square roots and squaring without multiplication and division
Post by: Mikl__ on April 22, 2015, 05:58:23 PM
Hi, Gunther!
picture with formulas in attach
maybe I'll show specific examples?
√{237}=√137438953472=370727=1.0110.1010.0000.1001.11
√{249-1}=√562949953421311=23726566=1.0110.1010.0000.1001.1110.0110
√{250-1}=√1125899906842623=√11111111111111111111111111111111111111111111111111=33554431=1111111111111111111111111
11111111111111111111111112=335544312=1125899839733761=11111111111111111111111100000000000000000000000001
111112=312=961=11110000012

Title: Re: square roots and squaring without multiplication and division
Post by: dedndave on April 22, 2015, 11:10:04 PM
can you cite the original article ?
Title: Re: square roots and squaring without multiplication and division
Post by: Mikl__ on April 22, 2015, 11:37:55 PM
I have not yet written an article about it :)
Title: Re: square roots and squaring without multiplication and division
Post by: qWord on April 22, 2015, 11:43:32 PM
Exponentation: Identities and properties (http://en.wikipedia.org/wiki/Exponentiation#Identities_and_properties)

e.g.
sqrt(237) = (232 * 24 * 21)1/2 = (232)1/2 (24)1/2 (21)1/2 = 2162221/2
Title: Re: square roots and squaring without multiplication and division
Post by: Gunther on April 23, 2015, 12:43:31 AM
Mikl__,

your image makes it clear. Thank you.

qWord,

:t

Gunther
Title: Re: square roots and squaring without multiplication and division
Post by: Mikl__ on April 23, 2015, 09:44:53 AM
Quote from: qWord on April 22, 2015, 11:43:32 PM
Exponentation: Identities and properties (http://en.wikipedia.org/wiki/Exponentiation#Identities_and_properties)

e.g.
sqrt(237) = (232 * 24 * 21)1/2 = (232)1/2 (24)1/2 (21)1/2 = 2162221/2
Hi, qWord!
talked about another case
sqrt(237) =sqrt(22x18+1) =sqrt(2)x218 in the square root is 18+1=19 binary digits, square root from 2 we know, it is 1,4142135623730950488016887242097 or 1.6A09E66...16=1,0110.1010.0000.1001.1110.0110.0110...2
therefore sqrt(237) =1.0110.1010.0000.1001.11=370727
Title: Re: square roots and squaring without multiplication and division
Post by: rrr314159 on April 23, 2015, 03:54:06 PM
Hi Miki,

It took some thought to see what you're doing here, pretty clever but I don't think it's worth a Fields medal yet.

1) ------------------------------------------------------------------------------------

First, let x = sqrt(2^(2n+1)) = sqrt(2^2n)*sqrt(2) = 2^n * sqrt(2) = sqrt(2) left-shifted by n.

So, if you express sqrt(2) in binary, = 1.0110101000001001 etc, you can immediately write down x by shifting the "decimal" (or, radix) point by n.

Thus, sqrt(2^7) = sqrt(2^(2n+1)) = 1011 (plus remainder of course) = 11, which is right - that's the truncated sqrt of 128. And, you give a good example in the last post using sqrt(2^37).

Now, this is generally true. Given any radix r, if we can express a number

x = sqrt(r^(2n+1)) = r^n*sqrt(r)

, and we know sqrt(r) in that radix, we can use the same trick. For example base 10:

x = sqrt(10^7) = 10^3 * sqrt(10) = 3.162278... shifted 3 places = 3,162 + remainder.

In fact it doesn't have to be a square root. If we know the number's representation in a radix, to find it times r^n just shift the radix point. For instance

pi*10^3 = 3.14159265 shifted 3 places (a.k.a. 3.14159265 e3) = 3141 (remainder .59265 etc)

Which of course is very well known. Another example, since 1.6875 = 1.1011 binary, times 8 = 1101.1 binary.

2) ------------------------------------------------------------------------------------

Now, the other main point you have is the fact that in binary, (111...(n times))^2 = 111(n-1 times)...000(n times)...1. An example will make it more clear,

In binary: 11111^2 = 1111000001. In decimal: 31^2 = 961 = 512+256+128+64+1

We can see why this is as follows. 111...(n times) = 2^(n+1) - 1. So

111...(n times)^2 = (2^(n+1) - 1)^2 = 2^(n+1)^2 - 2*2^(n+1) + 1 = 2^(2n+2) - 2^(n+2) + 1

Now in general, 2^m - 2^n (with m > n) will consist of (m-n) 1's followed by n zeroes. For example, 2^10 - 2^6 =

10000000000 -
       1000000 =
01111000000

You see, subtracting in the normal way, on the right it's all zeros till we get to "0-1" which gives a 1, carry the 1. then it continues being 1's until the end when the carry from the right makes the last digit 0. So in this case,

1024 - 64 = 960 = 512+256+128+64 (+ zero's)

Stick on the last 1, and we have the example given above, 31^2 = 961.

And so, in binary given n-1 1's followed by n 0's and a 1, we can immediately write the sqrt:

sqrt(1) = 1, sqrt(1001) = 11, sqrt(110001) = 111, sqrt(11100001) = 1111, sqrt(11111100000001) = 1111111 etc

i.e. sqrt(9) = 3, sqrt(32+16+1) = sqrt(49) = 7, sqrt(128+64+32+1) = sqrt(225) = 15, sqrt(16129) = 127 etc

In base 10 there's a similar trick, but instead of a 1 we must use 5, namely, half the radix.

99995^2 = (2^5 - 5)^2 = 9999000025

Because the same subtraction as above gives a very analogous result, for the same reason (consider the "carry"):

10000000000 -
       1000000 =
09999000000

So given n 9's followed by n zero's then 25, we immediately know the square root is n 9's and a 5, without having to compute it. For instance,

sqrt(9999999999000000000025) = 99999999995. Or sqrt(9025) = 95, sqrt(990025) = 995, etc.

3) ------------------------------------------------------------------------------------

Ok, apart from those rather clever points, you have a couple mistakes. You seem to have confused 2^n with n 1's. Thus you say,

sqrt(111...(2n 1's)) = 111...(n 1's)

, in the first post and also in the picture, but no that's not true. For instance sqrt(15) does not equal 3. What is true, sqrt(2^2n) = 2^n, thus sqrt(16) does equal 4. And, the same confusion appears in couple other places. Actually a string of 1's, in radix 2, can never be a perfect square.

4) ------------------------------------------------------------------------------------

Off the top of my head I thought you could never have such a form in any radix. Thus in base 10 it can easily be shown a string of 1's can't be a perfect square: 11, 111, 1111, 11111 ... never square, forget it. Well, of course, "1" is square in any radix, and "11" in any radix 1 less than a square: thus 11 (radix 3) = 4, 11 (radix 63) = 64 etc. But 3 or more, seems impossible at first.

But if you think about it, it's interesting to note there are two cases (at least).

radix 3: sqrt(11111) = (decimal) sqrt(81+27+9+3+1) = sqrt(121) = sqrt(11) or, back to radix 3, = 102

and,

radix 7: sqrt(1111) = (decimal) sqrt(343+49+7+1) = sqrt(400) = sqrt(20) or, back to radix 7, = 26

I doubt there are any others?

------------------------------------------------------------------------------------

Miki, keep at it, a Fields medal is only $15,000 but a millenium prize is a million bucks...! I expect a cut, for helping you on the road to success ;)
Title: Re: square roots and squaring without multiplication and division
Post by: Mikl__ on April 23, 2015, 05:43:29 PM
Hi, rrr314159!
many thanks for the tips
QuoteOk, apart from those rather clever points, you have a couple mistakes. You seem to have confused 2^n with n 1's. Thus you say,

sqrt(111...(2n 1's)) = 111...(n 1's)

, in the first post and also in the picture, but no that's not true. For instance sqrt(15) does not equal 3. What is true, sqrt(2^2n) = 2^n, thus sqrt(16) does equal 4. And, the same confusion appears in couple other places. Actually a string of 1's, in radix 2, can never be a perfect square.
I wrote about the integer part of the square root. It's easy enough to check:
integer(√1111)=integer(√15)=integer(3,8729833462074168851792653997824)=112
integer(√11111111)=integer(√255)=integer(15,968719422671311999070245176981)=11112
integer(√1111111111111111)=integer(√65535)=integer(255,99804686754936255911520419041)=111111112
P.S. I do not fall under the criteria for awarding the Fields Medal, since I'm not a mathematician and I am more than 40 (http://www.cyberforum.ru/images/smilies/smile3.gif)

Title: Re: square roots and squaring without multiplication and division
Post by: rrr314159 on April 23, 2015, 06:39:42 PM
Of course, it's correct with the understanding that you're talking about the integer part. I don't see it in the picture you attached, but that's alright.

ps, the millennium prize is still open to old people, and since Perlman didn't take it, I think they've got plenty of cash on hand
Title: Re: square roots and squaring without multiplication and division
Post by: Mikl__ on April 23, 2015, 07:45:10 PM
rrr314159,
Quotethe millennium prize is still open to old people
After these words, I feel decrepit invalid. I wanted to write that "The Fields Medal is a prize awarded to two, three, or four mathematicians under 40 years of age at the International Congress of the International Mathematical Union (IMU), a meeting that takes place every four years." and I am 42 (http://www.cyberforum.ru/images/smilies/smile3.gif)
Title: Re: square roots and squaring without multiplication and division
Post by: Gunther on April 24, 2015, 02:04:50 AM
Quote from: Mikl__ on April 23, 2015, 07:45:10 PM
... and I am 42 (http://www.cyberforum.ru/images/smilies/smile3.gif)

That's a little bit to old, my friend. Bad luck.

Gunther
Title: Re: square roots and squaring without multiplication and division
Post by: Mikl__ on April 24, 2015, 10:19:25 AM
QuoteThat's a little bit to old
Gunther,
(http://www.cyberforum.ru/images/smilies/good3.gif)
QuoteBad luck.
Why? (http://www.cyberforum.ru/images/smilies/be.gif)
Title: Re: square roots and squaring without multiplication and division
Post by: Gunther on April 24, 2015, 11:05:12 PM
Quote from: Mikl__ on April 24, 2015, 10:19:25 AM
Why? (http://www.cyberforum.ru/images/smilies/be.gif)

It has to do with the age limit for the Fields Medal.  :lol: But there are other open questions, for example the Collatz conjecture (https://en.wikipedia.org/wiki/Collatz_conjecture). By solving it, you can achieve a lot of fame. It is perhaps partly solved, but I'm not sure. You can check some interesting details here (http://preprint.math.uni-hamburg.de/public/papers/hbam/hbam2011-09.pdf).

Gunther
Title: Re: square roots and squaring without multiplication and division
Post by: Mikl__ on April 25, 2015, 10:36:43 AM
Hi, Gunther!
Thank you (http://www.cyberforum.ru/images/smilies/smile3.gif)
Title: Re: square roots and squaring without multiplication and division
Post by: rrr314159 on April 25, 2015, 02:28:30 PM
Quote from: MikiI feel decrepit invalid

Quote from: MikiI am 42

Yes I know what you mean, and feel very sorry for you. At 41, a person is still young. Life is full of possibilities, you can still learn new things, start a new career: it's almost like being 30, which is not that different from 21. But once you hit 42, let's face it, time to give up. Fortunately nursing homes accept 42-year olds, in fact many specialize in that age group. If you eat right and try to get some exercise every day - say, a couple mile's slow walk around the park - you might last a few years, but the time is getting short. At 42, you could go at any time: heart, lungs, brain, digestive system - anything might fail - often they all go at once. Dunno if you've decided yet: I recommend cremation, it's so much simpler. But hey, it's your funeral
Title: Re: square roots and squaring without multiplication and division
Post by: Gunther on April 26, 2015, 03:43:40 AM
Hi Mikl__,

Quote from: Mikl__ on April 25, 2015, 10:36:43 AM
Hi, Gunther!
Thank you (http://www.cyberforum.ru/images/smilies/smile3.gif)

you're welcome. Do you need some other advice regarding outstanding issues?  :lol: :lol: :lol:

Gunther
Title: Re: square roots and squaring without multiplication and division
Post by: rrr314159 on April 27, 2015, 06:14:59 PM
p.s., just kidding Miki, nothing wrong with 42, in fact according to "Hitchhiker's guide to the Galaxy" it's the "Answer to The Ultimate Question of Life, the Universe, and Everything". It's superior to both 41 and 43, I'd say - unless you prefer primes, of course. And let's face it, many people do. :icon_confused:

Anyway, :biggrin: