[Edu-sig] More practice exercises

kirby urner kirby.urner at gmail.com
Sat Jun 11 22:04:05 CEST 2011


There's a totient function based on knowing the prime factors of n.

Line 13 on this page:  http://mathworld.wolfram.com/TotientFunction.html

The one I use in beginning Python is just

len([num for num in range(1,n) if gcd(num, n)==1 ]  # count strangers to n

... where gcd is Guido's four liner.

I'm sure the latter is way too slow and brutish for Euler Project esoterica.

I confess to a knee-jerk reaction against a 3rd and 2nd power being
described as cube and square respectively, as much good sense as this
customarily makes in Earthling Math.

I've been groomed to have odd biases.

Kirby


On Sat, Jun 11, 2011 at 11:50 AM, Gregor Lingl <gregor.lingl at aon.at> wrote:

>  Am 11.06.2011 19:54, schrieb kirby urner:
>
>
>  I've been looking these over since reading your post.  I'd heard of this
> project but this was my first time to really check it out.
>
>  ...
>
>  Thanks for these links.  Python should be fast enough to get within the
> one minute time frame one would think, at least on some of them.
>
> It is definitely! I got a solution to problem 341, that needed less the 15
> seconds.
> I've no solution to 342 yet. As "your" Euler totient is the central point
> of the problem, I thought this is your thing - and you can't help to solve
> it   ;-)
>
> Best wishes
> Gregor
>
>
>  Kirby
>
>
>  On Sat, Jun 11, 2011 at 9:26 AM, Gregor Lingl <gregor.lingl at aon.at>wrote:
>
>> A very interesting collection of exercises you can find on
>>
>> http://projecteuler.net/
>>
>> Especially the problems below 100 are well suited for beginners.
>>
>> http://projecteuler.net/index.php?section=problems
>>
>> This week's problem, on the contrary, seems to be customized for Kirby!
>>
>> http://projecteuler.net/index.php?section=problems&id=342
>>
>> Best regards,
>> Gregor
>>
>
> _______________________________________________
> Edu-sig mailing list
> Edu-sig at python.orghttp://mail.python.org/mailman/listinfo/edu-sig
>
>
>
> _______________________________________________
> Edu-sig mailing list
> Edu-sig at python.org
> http://mail.python.org/mailman/listinfo/edu-sig
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/edu-sig/attachments/20110611/8fef98ac/attachment-0001.html>


More information about the Edu-sig mailing list