"sex.vc" load "intSqrt.vc" load "gcd.vc" load 0 fix 60 'base def col2 dim 'n def 0 'i def n { col2(i) reversed sexValue 'w def col3(i) reversed sexValue 'd def i 1 + 'i def # "w = " w + ! # "w^2 = " w dup * + ! # "d = " d + ! # "d^2 = " d dup * + ! d dup * w dup * - intSqrt 'l def # "l = " l + ! w d gcd 'g def w g idiv 'a def l g idiv 'b def d g idiv 'c def b 2 mod 0 eq { a c + 2 idiv intSqrt 'p def b 2 p * idiv 'q def }{ b c + 2 idiv intSqrt 'p def a 2 p * idiv 'q def } ifelse # "p = " p + ! # "q = " q + ! # p dup * q dup * + ! # p dup * q dup * - ! # 2 p * q * ! d p dup * q dup * + idiv 'm def # "m = " m + ! # "----------" ! "\+ \hfill " i + " & \hfill " + p + " & \hfill " + q + " & \hfill " + m + " & \cr " + ! } repeat