Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Commonmark migration
Source Link

#05AB1E , (削除) 21 (削除ここまで)(削除) 20 (削除ここまで) 18 bytes

05AB1E , (削除) 21 (削除ここまで)(削除) 20 (削除ここまで) 18 bytes

ÎFˆ∞.Δ ̄θ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:
 ˆ # Pop the current number and add it to the global_array
 ∞.Δ # 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 `y`
 b # Convert it to binary
 SO # Sum it's binary digits
 ̄yå_ # Check if the loop-number `y` 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)

#05AB1E , (削除) 21 (削除ここまで)(削除) 20 (削除ここまで) 18 bytes

ÎFˆ∞.Δ ̄θ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:
 ˆ # Pop the current number and add it to the global_array
 ∞.Δ # 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 `y`
 b # Convert it to binary
 SO # Sum it's binary digits
 ̄yå_ # Check if the loop-number `y` 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)

05AB1E , (削除) 21 (削除ここまで)(削除) 20 (削除ここまで) 18 bytes

ÎFˆ∞.Δ ̄θ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:
 ˆ # Pop the current number and add it to the global_array
 ∞.Δ # 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 `y`
 b # Convert it to binary
 SO # Sum it's binary digits
 ̄yå_ # Check if the loop-number `y` 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)
deleted 11 characters in body
Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394

#05AB1E, (削除) 21 (削除ここまで) (削除) 20 (削除ここまで) 1918 bytes

ÎFDˆ∞ÎFˆ∞.Δ ̄θ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 Try it online or verify the first \$n\$ terms verify the first \$n\$ terms.

Explanation:

Î # Push 0 and the input
 F # Loop the input amount of times:
 ˆ  # AddPop the current number and add it 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 `y`
 b # Convert it to binary
 SO # Sum it's binary digits
 ̄yå_ # Check if the loop-number `y` 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)

#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:
  # 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)

#05AB1E, (削除) 21 (削除ここまで) (削除) 20 (削除ここまで) 18 bytes

ÎFˆ∞.Δ ̄θ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:
 ˆ  # Pop the current number and add it to the global_array
 ∞.Δ # 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 `y`
 b # Convert it to binary
 SO # Sum it's binary digits
 ̄yå_ # Check if the loop-number `y` 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)
added 846 characters in body
Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394

#05AB1E, (削除) 21 (削除ここまで) 20(削除) 20 (削除ここまで) 19 bytes

ÎF©∞ÎFDˆ∞.Δ®y^bSO ̄yå_*}DˆΔ ̄θy^bSO ̄yå_*

Can definitely be golfed some more..

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 Try it online or verify the first \$n\$ terms verify the first \$n\$ terms.

Explanation:

Î # Push 0 and the input
 F # Loop the input amount of times:
 ©  # StoreAdd the current number into the registerglobal_array (without popping)
 ∞.Δ # Inner loop starting at 1 to find the first number which is truthy for:
 ®y^ ̄θy^ # XOR the last number (fromof the register)global_array andwith the loop-number
 b # Convert it to binary
 SO # Sum it's binary digits
 ̄yå_ # Check if the loop-number is notNOT in the global_array yet
 * # Multiply both (only if this is 1 (truthy) the inner loop will stop)
 }D # After the inner loop: duplicate the found number
 ˆ # And pop and push it to the global_array
 # (after the outer looploops, output the top of the stack implicitly)

#05AB1E, (削除) 21 (削除ここまで) 20 bytes

ÎF©∞.Δ®y^bSO ̄yå_*}Dˆ

Can definitely be golfed some more..

Pretty inefficient, so the larger the input, the longer it takes to get the result.

Try it online or verify the first \$n\$ terms.

Explanation:

Î # Push 0 and the input
 F # Loop the input amount of times:
 © # Store the current number in the register (without popping)
 ∞.Δ # Inner loop starting at 1 to find the first number which is truthy for:
 ®y^ # XOR the last number (from the register) and 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 loop will stop)
 }D # After the inner loop: duplicate the found number
 ˆ # And pop and push it to the global_array
 # (after the outer loop, output the top of the stack implicitly)

#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:
  # 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)
added 846 characters in body
Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394
Loading
Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394
Loading

AltStyle によって変換されたページ (->オリジナル) /