16 "execution_count": 13,
18 "output_type": "execute_result"
27 "execution_count": 27,
38 "execution_count": 27,
40 "output_type": "execute_result"
44 "results = Hash.new {|x| Set.new}\n",
45 "(1..1000).each do |p|\n",
46 " (1..(p/3)).each do |a|\n",
47 " (1..((p-a)/2)).each do |b|\n",
49 " if a ** 2 + b ** 2 == c ** 2\n",
50 " # puts \"p = #{p}, a, b, c: #{a} #{b} #{c}\"\n",
51 " results[p] = results[p].add(Set.new [a, b, c])\n",
60 "execution_count": 28,
71 "execution_count": 28,
73 "output_type": "execute_result"
82 "execution_count": 29,
93 "execution_count": 29,
95 "output_type": "execute_result"
99 "results.keys.max_by {|p| results[p].length}"
104 "execution_count": null,
114 "display_name": "Ruby 2.4.0",
119 "file_extension": ".rb",
120 "mimetype": "application/x-ruby",