Guest User

Untitled

a guest
Dec 12th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.16 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. ans = []
  3. 2.upto(100) {|a|
  4. 2.upto(100) {|n|
  5. m = a ** n
  6. ans << m if m.to_s.split(//).map(&:to_i).reduce(&:+) == a
  7. }
  8. }
  9. p ans.sort[29]
Add Comment
Please, Sign In to add comment