Recommended Posts

I have been writing a program for my TI-83 that simplifies radicals. For example, if you enter 512, it tells you that that is 16 * radical(2). I simply take the square root of the number entered and start at the largest integer not more than that square root, and decrease the number by one in each iteration. For each number, I square it, and if the square divides evenly into the original number (ex. 512), you factor that number out, and you are done. However, this is very slow when you start working with large numbers. Does anyone know of an algorithm or equation that is more efficient? Thanks!
-----------------------------
Weeks of programming can save you hours of planning.
There are 10 kinds of people in this world-- those who understand binary and those who don''t.

Share this post

Link to post

Share on other sites

This is not homework. I''m trying to make a program on my calculator to do this so I can compare the speed of an algorithm that evaluates, say, the square root of 162 compared to one that evaluates nine times the square root of two. I''m trying a few different approaches to a fast square root- I know that this has been done millions of times before, but I get a lot of satisfaction from figuring these things out myself.

-----------------------------Weeks of programming can save you hours of planning.

There are 10 kinds of people in this world-- those who understand binary and those who don''t.

0

Share this post

Link to post

Share on other sites

Guest Anonymous Poster

I''ve got an idea. Say you have a "large" number like 5,012. First bitshift all the way to the right to isolate digit 5. Now, since this is base 10, you know that 5,000 equals 5 * 10 * 10 * 10. And you know you had to bitshift 3 times (ie 10 ^<b>3</b&gt by previously taking the length of the integer. So on the outside of the radical you already have 10*radical(10*5). Well, is that a start?

-leinad (my acct has been banned for some reason)

0

Share this post

Link to post

Share on other sites

That''s an interesting idea. One question, though- if I understand you right, you would end up with an answer like 50 radical(2) + 2 radical(3), correct? This is not actually what I was going for (I meant simplest radical form), but I''ll try it out for efficiency anyway!

-----------------------------Weeks of programming can save you hours of planning.

There are 10 kinds of people in this world-- those who understand binary and those who don''t.

Share on other sites

Guest Anonymous Poster

Share this post

Link to post

Share on other sites

Perhaps it would be better to start at the bottom - since, for example, it''s very likely to have a sqrt(2) in it. You could go from 2 to sqrt of your number, checking if you get a perfect square when you divide your number by it.