count lattice2 by lynn(llhuii, explained)

# https://en.wikipedia.org/wiki/Gauss_circle_problem#Exact_forms
N=lambda r:1+4*sum(r/(4*i+1)-r/(4*i+3) for i in range(999))

# sum results for z-slices of cubic lattice:
for r in range(51): print sum(N(r*r-z*z) for z in range(-r,r+1))

# then golf a lot :)

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