Sums of two squares by mitchs

puts$<.map{*r=[0,1]
eval(gets).map{|q,e|r*=~e%2|a=3&~b=q-1|i=1
eval"a=e**q[i-=i>2?1:e-=a=1]*a*a%q while-a*a%q!=1
a=b%b=a while b*b>q"*a+%w{;r= |(a=-a; )}*'r.map{|c,d|[(b*c-d*a).abs,b*d+a*c].sort}'*e/=2-a/2}
r.sort.map{|x|x*'^2 + '+'^2'}*' = '}

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