fork(1) download
  1. from itertools import combinations
  2. lst = []
  3. for n in range(3, 33):
  4. cnt = 0
  5. for a, b, c in combinations(range(1, n + 1), 3):
  6. if a + b > c:
  7. cnt += 1
  8. ref = n*n - 7*n + 13
  9. a173196 = int((4*n**3-18*n**2+20*n-3+3*(-1)**n)/48)
  10. print("{:3d}: {:5d} ({:5d}, {:5})".format(n, cnt, ref, a173196))
  11. lst.append(cnt)
  12.  
  13. print(",".join(map(str,lst)))
Success #stdin #stdout 0.13s 10088KB
stdin
Standard input is empty
stdout
  3:     0 (    1,     0)
  4:     1 (    1,     1)
  5:     3 (    3,     3)
  6:     7 (    7,     7)
  7:    13 (   13,    13)
  8:    22 (   21,    22)
  9:    34 (   31,    34)
 10:    50 (   43,    50)
 11:    70 (   57,    70)
 12:    95 (   73,    95)
 13:   125 (   91,   125)
 14:   161 (  111,   161)
 15:   203 (  133,   203)
 16:   252 (  157,   252)
 17:   308 (  183,   308)
 18:   372 (  211,   372)
 19:   444 (  241,   444)
 20:   525 (  273,   525)
 21:   615 (  307,   615)
 22:   715 (  343,   715)
 23:   825 (  381,   825)
 24:   946 (  421,   946)
 25:  1078 (  463,  1078)
 26:  1222 (  507,  1222)
 27:  1378 (  553,  1378)
 28:  1547 (  601,  1547)
 29:  1729 (  651,  1729)
 30:  1925 (  703,  1925)
 31:  2135 (  757,  2135)
 32:  2360 (  813,  2360)
0,1,3,7,13,22,34,50,70,95,125,161,203,252,308,372,444,525,615,715,825,946,1078,1222,1378,1547,1729,1925,2135,2360