fork(1) download
  1. def b(n):m=n-1;g=range(n);return[bin(sum(2**p for p in 0<r<m and{0,m,r,m-r}or g))[2:]for r in g]
  2.  
  3. for n in range(1,20,2):
  4. print('Test {0}'.format(n))
  5. print('\n'.join(r for r in b(n)))
  6. print('')
Success #stdin #stdout 0s 9024KB
stdin
Standard input is empty
stdout
Test 1
1

Test 3
111
111
111

Test 5
11111
11011
10101
11011
11111

Test 7
1111111
1100011
1010101
1001001
1010101
1100011
1111111

Test 9
111111111
110000011
101000101
100101001
100010001
100101001
101000101
110000011
111111111

Test 11
11111111111
11000000011
10100000101
10010001001
10001010001
10000100001
10001010001
10010001001
10100000101
11000000011
11111111111

Test 13
1111111111111
1100000000011
1010000000101
1001000001001
1000100010001
1000010100001
1000001000001
1000010100001
1000100010001
1001000001001
1010000000101
1100000000011
1111111111111

Test 15
111111111111111
110000000000011
101000000000101
100100000001001
100010000010001
100001000100001
100000101000001
100000010000001
100000101000001
100001000100001
100010000010001
100100000001001
101000000000101
110000000000011
111111111111111

Test 17
11111111111111111
11000000000000011
10100000000000101
10010000000001001
10001000000010001
10000100000100001
10000010001000001
10000001010000001
10000000100000001
10000001010000001
10000010001000001
10000100000100001
10001000000010001
10010000000001001
10100000000000101
11000000000000011
11111111111111111

Test 19
1111111111111111111
1100000000000000011
1010000000000000101
1001000000000001001
1000100000000010001
1000010000000100001
1000001000001000001
1000000100010000001
1000000010100000001
1000000001000000001
1000000010100000001
1000000100010000001
1000001000001000001
1000010000000100001
1000100000000010001
1001000000000001001
1010000000000000101
1100000000000000011
1111111111111111111