"Tim Roberts" <t...@probo.com> wrote in message
news:5na7c6dlv0qii3pta58as50lmjcrrtk...@4ax.com...
Baba <raoul...@gmail.com> wrote:

a^a + b^b = c^c is the condition to satisfy

No, it's not.  It's a^2 + b^2 = c^2, where a, b, and c are integers.
Perhaps you meant a*a + b*b = c*c.

Or possibly a**2 + b**2 = c**2

and i need to use loops
and "n" will be an upper limit of one (or more?) of the loops but i am
a bit lost. Please help me get thinking about this right.

The simplest (but not most efficient) method is brute force, using three
loops, one each for a, b, and c.  You can compute the largest "c" you will
need by computing the square root of a*a+b*b.

If square roots have to be used, you might as well use the two-loop
algorithm, as you're nearly there.

A simpler estimate for the largest c is just a+b, although it might involve a few extra iterations.

--
Bartc
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to