fork(7) download
  1. from collections import defaultdict
  2.  
  3. N = 30
  4. D = defaultdict(int)
  5. for x in range(0,N+1):
  6. for y in range(0,N+1):
  7. for u in range(0,N+1):
  8. for v in range(0,N+1):
  9. if (x<u) or (x==u and y<v):
  10. D[ (x-u)**2 + (y-v)**2 ] += 1
  11. distances = [ (x,D[x]) for x in D ]
  12. distances.sort()
  13. for n in range(1,N+1): print('f({})={}'.format(n,distances[-n][1]))
Success #stdin #stdout 0.94s 10096KB
stdin
Standard input is empty
stdout
f(1)=2
f(2)=8
f(3)=12
f(4)=8
f(5)=16
f(6)=24
f(7)=20
f(8)=32
f(9)=18
f(10)=24
f(11)=40
f(12)=48
f(13)=28
f(14)=48
f(15)=60
f(16)=32
f(17)=32
f(18)=56
f(19)=72
f(20)=80
f(21)=36
f(22)=64
f(23)=84
f(24)=96
f(25)=50
f(26)=40
f(27)=72
f(28)=96
f(29)=112
f(30)=120