[ create a new paste ] login | about

Link: http://codepad.org/eq5LqB7o    [ raw code | output | fork ]

Ruby, pasted on Aug 27:
1
2
3
4
5
6
7
8
9
10
11
12
require 'scanf'

arr = []
for i in 100..999
	ei = i
	ei_arr = ei.to_s.split('').map(&:to_i)
	if ei%11 == 0 and ei/11 == ei_arr.inject{|sum,n| sum+((n.to_i)**2)}
		arr << ei
	end
end

puts arr


Output:
1
2
3
Line 6: wrong argument type Symbol (expected Proc) (TypeError)
	from t.rb:4:in `each'
	from t.rb:4


Create a new paste based on this one


Comments: