Thread: Square Root ?!?

  1. #1
    Registered User
    Join Date
    Feb 2004

    Square Root ?!?

    I want to make a program that can find the square root of a number. Yes, I do know about the sqrt() function. However, I don't want to find the square root of a number in decimal form. For instance, if I wanted to know the square root of 45, I want it to output "3 times the square root of 5."

  2. #2
    Super Moderator
    Join Date
    Sep 2001
    That's nice. Did you have a question?

    OK, OK... I'm guessing you want to know how to go about doing this. First of all, I'd ry putting questions like these in maybe the tech board, or something else to deal with general algorithms, but since I don't have the power to do this...

    There are all sorts of mathemaical rules about simplifying square roots into things like the example you cited. My advice would be to just build some data structures that allow the computer to go through and factor the number (which wouldn't be too hard - just reduce the number down to primes). Find out if x % 2 = 0, and so forth, constanrtly extracting until you get a list of primes. Extract duplicates from this list, place them outside the radical, and convert that data into an English sentence. Sounds like a fun porject actually.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. program to calculate the square root
    By saszew in forum C Programming
    Replies: 7
    Last Post: 10-28-2008, 12:53 PM
  2. square root bisection?? help
    By gagne73 in forum C++ Programming
    Replies: 4
    Last Post: 10-19-2007, 02:39 AM
  3. Forced moves trouble!!
    By Zishaan in forum Game Programming
    Replies: 0
    Last Post: 03-27-2007, 06:57 PM
  4. Bisection Method function value at root incorrect
    By mr_glass in forum C Programming
    Replies: 3
    Last Post: 11-10-2005, 09:10 AM
  5. Templated Binary Tree... dear god...
    By Nakeerb in forum C++ Programming
    Replies: 15
    Last Post: 01-17-2003, 02:24 AM