Created
May 29, 2011 06:28
-
-
Save johana-star/997520 to your computer and use it in GitHub Desktop.
Euler Project Problem #029
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Solution to Project Euler's twenty-ninth problem | |
# http://projecteuler.net/index.php?section=problems&id=29 | |
# Find the sum of all the numbers that can be written as the sum of fifth powers of | |
def generate_exponential_sequence(number) | |
array = [] | |
(2..number).each do |n| | |
(2..number).each do |exp| | |
array.push n**exp | |
end | |
end | |
return array | |
end | |
number = 100 | |
array = generate_exponential_sequence(number) | |
p array.uniq!.length |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment