Distinct powers
This is a boring problem. It is not a hard problem. One may even solve it by hand.
Update.
I am wrong on this problem, and when I was reviewing this problem several years ago, I am still not very careful about learning from others. This was changed only a few days ago when I was considering the number 100 to be changed to 100000 or larger.
I found my method ate a lot of memory and slow. Then I read the discussion thread again. Wow, the idea by jorgbrown and WP really helps a lot for me to understand the sieve method better! Please try to change the number 100 to 1000000 and see you code can give you the answer in one second or not.
The discussion really changed my view on sieve method, interesting!
No comments:
Post a Comment