First time here? Check out the FAQ!
answered 11 years ago
By the way, you can shorten the definition of your function nkfilter by doing:
sage: nkfilter = lambda N : [[n, k] for n in range(2, N+1) for k in range(1, n) if bin(n, k) <= N]