Skip to main content
Saved a byte
Source Link
The Thonnu
  • 18.3k
  • 3
  • 16
  • 74

05AB1E, 5 5 4 bytes

∞å0k>∞IKн

Try it online!Try it online!

-1 thanks to @KevinCruijssen

Explanation

∞IKн  # Implicit input
∞     # Push the infinite list [1, 2, 3, ...]
 IK   # Remove the elements of the input
   н  # First item

Old:

∞å0k>  # Implicit input
∞      # For each number in the infinite list [1, 2, 3, ...]
 å     # Is it in the input?
  0k   # Get the index of the first 0 (0-indexed)
    >  # And increment it to make it 1-indexed

05AB1E, 5 bytes

∞å0k>

Try it online!

Explanation

∞å0k>  # Implicit input
∞      # For each number in the infinite list [1, 2, 3, ...]
 å     # Is it in the input?
  0k   # Get the index of the first 0 (0-indexed)
    >  # And increment it to make it 1-indexed

05AB1E, 5 4 bytes

∞IKн

Try it online!

-1 thanks to @KevinCruijssen

Explanation

∞IKн  # Implicit input
∞     # Push the infinite list [1, 2, 3, ...]
 IK   # Remove the elements of the input
   н  # First item

Old:

∞å0k>  # Implicit input
∞      # For each number in the infinite list [1, 2, 3, ...]
 å     # Is it in the input?
  0k   # Get the index of the first 0 (0-indexed)
    >  # And increment it to make it 1-indexed
Source Link
The Thonnu
  • 18.3k
  • 3
  • 16
  • 74

05AB1E, 5 bytes

∞å0k>

Try it online!

Explanation

∞å0k>  # Implicit input
∞      # For each number in the infinite list [1, 2, 3, ...]
 å     # Is it in the input?
  0k   # Get the index of the first 0 (0-indexed)
    >  # And increment it to make it 1-indexed