fork download
  1. def f(m,n):a=d=i=0;r=[()]*n;exec"i+=1;r[a%n]+=i,;d^='7'[:i%7]in`i`;a+=1-2*d;"*m;print r
  2.  
  3. f(30, 5)
  4. f(42, 5)
  5. f(20, 3)
  6. f(14, 10)
Success #stdin #stdout 0.03s 9120KB
stdin
Standard input is empty
stdout
[(1, 6, 8, 13, 15, 19, 23, 30), (2, 7, 12, 16, 18, 24), (3, 11, 17, 25), (4, 10, 21, 26, 28), (5, 9, 14, 20, 22, 27, 29)]
[(1, 6, 8, 13, 15, 19, 23, 30, 35, 39), (2, 7, 12, 16, 18, 24, 31, 40), (3, 11, 17, 25, 32, 41), (4, 10, 21, 26, 28, 33, 37, 42), (5, 9, 14, 20, 22, 27, 29, 34, 36, 38)]
[(1, 4, 7, 10, 13, 15, 19), (2, 5, 9, 12, 16, 18), (3, 6, 8, 11, 14, 17, 20)]
[(1, 13), (2, 12), (3, 11), (4, 10), (5, 9), (6, 8), (7,), (), (), (14,)]