#05AB1E, (削除) 21 (削除ここまで) (削除) 20 (削除ここまで) 19 bytes
ÎFDˆ∞.Δ ̄θy^bSO ̄yå_*
Pretty inefficient, so the larger the input, the longer it takes to get the result. Does work for input 0 as well, though.
Try it online or verify the first \$n\$ terms.
Explanation:
Î # Push 0 and the input
F # Loop the input amount of times:
Dˆ # Add the current number to the global_array (without popping)
∞.Δ # Inner loop starting at 1 to find the first number which is truthy for:
̄θy^ # XOR the last number of the global_array with the loop-number
b # Convert it to binary
SO # Sum it's binary digits
̄yå_ # Check if the loop-number is NOT in the global_array yet
* # Multiply both (only if this is 1 (truthy) the inner loop will stop)
# (after the loops, output the top of the stack implicitly)
Kevin Cruijssen
- 136.2k
- 14
- 154
- 394