Skip to content

Instantly share code, notes, and snippets.

@johana-star
Created May 29, 2011 06:28
Show Gist options
  • Save johana-star/997520 to your computer and use it in GitHub Desktop.
Save johana-star/997520 to your computer and use it in GitHub Desktop.
Euler Project Problem #029
# 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