Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Finding a sum of two squares that is itself the sum of two squares

I am trying to write something that has a variable d that is the sum of two squares where one of the summands is also the sum of two squares. I tried something like

for d in srange(1,100): for e in srange(1,100): for f in srange(1,100): for g in srange(1,100): for h in srange(1,100): if d==e^2+f^2 and e==g^2+h^2 print(d,e,f,g,h)

But it takes wayyyyyy to long to compute, is there a way to use 'from sage.rings.sum_of_squares import two_squares_pyx' to not brute force this?

Finding a sum of two squares that is itself the sum of two squares

I am trying to write something that has a variable d that is the sum of two squares where one of the summands is also the sum of two squares. I tried something like

for d in srange(1,100):
  for e in srange(1,100):
     for f in srange(1,100):
          for g in srange(1,100):
              for h in srange(1,100):
                    if d==e^2+f^2 and e==g^2+h^2
                            print(d,e,f,g,h)

print(d,e,f,g,h)

But it takes wayyyyyy to long to compute, is there a way to use 'from sage.rings.sum_of_squares import two_squares_pyx' to not brute force this?