%%HP: T(3)A(D)F(.); @ SSQR, Simplifies SQuare Roots of integers, by Joe Horn @ Input: positive integer (NOT its square root!). @ Output: Square root of that integer in simplified algebraic form. @ Requires the FCTR.LIB library, available on GD8. IF DUP 1 > THEN RCLF SWAP -2 SF -3 CF DUP 1 \-> n \<< Factor OBJ\-> 1 SWAP START IF DUP2 SAME THEN 'n' STO* DROP 1 ELSE DROP END NEXT n SWAP IF DUP 1 == THEN SWAP END OVER SQ / IF DUP 1 > THEN '\v/X' { X } ROT + \|vMATCH DROP IF OVER 1 == THEN SWAP DROP ELSE * END ELSE DROP END SWAP STOF \>> END