Skip to main content
edited body
Source Link
Zgarb
  • 43.2k
  • 4
  • 84
  • 265

J, 1212 11 bytes

@MartinBüttner saved a byte.

2|+~:/@#:"0@i. 

This is a monadic (meaning unary) function, used as follows:

 f =: 2|+~:/@#:"0@i. f 10 0 1 1 0 1 0 0 1 1 0 

Explanation

I'm using the alternative definition that Tn is the parity of the number of 1-bits in the binary representation of n.

2|+~:/@#:"0@i. Input is n. 2| ~:/ Output is the list of parities of +/  theXOR sumsfolded ofover   @#: the binary representations of   "0 each element of   @i. integers from 0 to n-1. 

J, 12 bytes

2|+/@#:"0@i. 

This is a monadic (meaning unary) function, used as follows:

 f =: 2|+/@#:"0@i. f 10 0 1 1 0 1 0 0 1 1 0 

Explanation

I'm using the alternative definition that Tn is the parity of the number of 1-bits in the binary representation of n.

2|+/@#:"0@i. Input is n. 2|  Output is the list of parities of +/  the sums of   @#: binary representations of   "0 each element of   @i. integers from 0 to n-1. 

J, 12 11 bytes

@MartinBüttner saved a byte.

~:/@#:"0@i. 

This is a monadic (meaning unary) function, used as follows:

 f =: ~:/@#:"0@i. f 10 0 1 1 0 1 0 0 1 1 0 

Explanation

I'm using the alternative definition that Tn is the parity of the number of 1-bits in the binary representation of n.

~:/@#:"0@i. Input is n. ~:/ Output is XOR folded over @#: the binary representations of "0 each element of @i. integers from 0 to n-1. 
Source Link
Zgarb
  • 43.2k
  • 4
  • 84
  • 265

J, 12 bytes

2|+/@#:"0@i. 

This is a monadic (meaning unary) function, used as follows:

 f =: 2|+/@#:"0@i. f 10 0 1 1 0 1 0 0 1 1 0 

Explanation

I'm using the alternative definition that Tn is the parity of the number of 1-bits in the binary representation of n.

2|+/@#:"0@i. Input is n. 2| Output is the list of parities of +/ the sums of @#: binary representations of "0 each element of @i. integers from 0 to n-1.