#05AB1E, 4 bytes, Paul Picard, A001317
05AB1E, 4 bytes, Paul Picard, A001317
Code:
$Fx^ Explanation:
$ # Pushes 1 and input F # Pops x, creates a for-loop in range(0, x) x # Pops x, pushes x and 2x ^ # Bitwise XOR on the last two elements # Implicit, ends the for-loop # Implicit, nothing has printed so the last element is printed automatically The sequence basically is a binary Sierpinski triangle:
f(0)= 1 =1 f(1)= 1 1 =3 f(2)= 1 0 1 =5 f(3)= 1 1 1 1 =15 f(4)= 1 0 0 0 1 =17 And translates to the formula a(n) = a(n - 1) XOR (2 × a(n - 1))
Luckily, I remembered this one :)