Skip to content

Instantly share code, notes, and snippets.

@joecannatti
Created December 28, 2011 02:38
Show Gist options
  • Save joecannatti/1525904 to your computer and use it in GitHub Desktop.
Save joecannatti/1525904 to your computer and use it in GitHub Desktop.
Euler29
#!/usr/bin/env ruby
START=2
STOP=100
pairs_without_repeats = []
(START..STOP).each { |outer|
(START..outer).each{ |inner|
pairs_without_repeats << [outer,inner]
}
}
results = []
pairs_without_repeats.each { |pair|
results << pair[0] ** pair[1]
results << pair[1] ** pair[0]
}
p results.sort.uniq.size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment