[Tutor] Root and power

Alan Gauld alan.gauld at btinternet.com
Wed Jul 29 11:23:16 CEST 2015


On 29/07/15 04:29, Job Hernandez wrote:
> How is it going tutors?
>
> The following problem seems impossible to me:

I made a reply in the thread 'Abs' started on July 27th.

Basically you can use the pow() function.

The power lies between 1-5.
The largest root will be the same as the user input
since X**1 = X. So you always have at least 1 answer!

You need to iterate up to the power of 1 solution to
find if there is a smaller pair of integers.
Some may have several, for example 16 yields:

16**1
4**2
2**4

Your assignment doesn't make it clear how that should be handled...

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list