Loading ...
Sorry, an error occurred while loading the content.

re a^2 + Q*b^2

Expand Messages
  • ronhallam@lineone.net
    Does any one have a quick algorithm on solving the above type of equation? More specifically, 25 + 36(R^2-N) is the problem; my current algorithm is as
    Message 1 of 1 , Dec 2, 2003
    • 0 Attachment
      Does any one have a quick algorithm on solving the above type of equation?

      More specifically, 25 + 36(R^2-N) is the problem; my current algorithm
      is as follows:

      xSet = Set new.
      1 to: 100 do: [:x | xSet add:(x*x)\\100]. {gives all square endings}
      R = n isqrt2 + 1. {makes R greater than N}
      while false:[
      [t = R^2 -N.
      q := 25 + 36*t. xSet includes:q\\100] whilefalse:[R := R+1].
      p := q isqrt2.
      P*p = q ifTrue:[^true]
      ifFalse:[R:=R+1]]

      thanks in advance


      Ron
    Your message has been successfully submitted and would be delivered to recipients shortly.