Skip to content

Instantly share code, notes, and snippets.

@luciuschoi
Created October 29, 2014 07:00
Show Gist options
  • Save luciuschoi/716babb026193ad0698f to your computer and use it in GitHub Desktop.
Save luciuschoi/716babb026193ad0698f to your computer and use it in GitHub Desktop.
ruby playground
self_number=[]
arr_number = []
5000.times do | i |
real_number = i + 1
temp_str = real_number.to_s
str_len = temp_str.length
sum = 0
str_len.times do | j |
sum += temp_str[j].to_i
end
sum += real_number
arr_number << sum
end
5000.times do |i|
re = i+1
if !arr_number.include?(re)
self_number << re
end
end
puts self_number.inject(:+)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment