Skip to main content
deleted 2 characters in body
Source Link
G B
  • 22.8k
  • 1
  • 20
  • 53

Ruby, 8887 bytes

->a,b{*r=0,0,w=-a*b;w=a*b;(k=*wk=*-w..-w).product(k).map{|x,y|r[w*w<=>x*x+y*y]+=1[x%a+y%b]};r[0,2]}

Try it online!Try it online!

Ruby, 88 bytes

->a,b{*r=0,0,w=-a*b;(k=*w..-w).product(k).map{|x,y|r[w*w<=>x*x+y*y]+=1[x%a+y%b]};r[0,2]}

Try it online!

Ruby, 87 bytes

->a,b{*r=0,0,w=a*b;(k=*-w..w).product(k).map{|x,y|r[w*w<=>x*x+y*y]+=1[x%a+y%b]};r[0,2]}

Try it online!

deleted 8 characters in body
Source Link
G B
  • 22.8k
  • 1
  • 20
  • 53

Ruby, 9888 bytes

->a,b{*r=0,0,w=-a*b;[*w.stepa*b;(k=*w..-w,a)].product([*w.step(-w,b)]k).map{|x,y|r[w*w<=>x*x+y*y]+=1y|r[w*w<=>x*x+y*y]+=1[x%a+y%b]};r[0,2]}

Try it online!Try it online!

Ruby, 98 bytes

->a,b{*r=0,0,w=-a*b;[*w.step(-w,a)].product([*w.step(-w,b)]).map{|x,y|r[w*w<=>x*x+y*y]+=1};r[0,2]}

Try it online!

Ruby, 88 bytes

->a,b{*r=0,0,w=-a*b;(k=*w..-w).product(k).map{|x,y|r[w*w<=>x*x+y*y]+=1[x%a+y%b]};r[0,2]}

Try it online!

Source Link
G B
  • 22.8k
  • 1
  • 20
  • 53

Ruby, 98 bytes

->a,b{*r=0,0,w=-a*b;[*w.step(-w,a)].product([*w.step(-w,b)]).map{|x,y|r[w*w<=>x*x+y*y]+=1};r[0,2]}

Try it online!