Sums of two squares by rotary-o

#!ruby -pl
*a=[0,1]
eval(gets).map{|i,j|v=i-u=k=2/i
(k+=u=1
l=63
v=i
0until i>v*u=l>2?u*u%i*k**i[l-=1]:v%v=u)until i%4>2?a*=j/=2:u>0
j.times{a=(a|a.map(&:reverse)).map{|x,y|[(x*v-y*u).abs,x*u+y*v].sort}|[]}}
$_=a.sort.map{|b|'%d^2 + %d^2'%b}*' = '

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

To protect the system from spam, please input your favorite sport (hint: I believe its name must start with 'g', case insensitive)

download

return to the top page