Skip to main content
deleted 119 characters in body
Source Link
emanresu A
  • 44.4k
  • 5
  • 101
  • 240

Vyxal, 87 bytes

›3•u~Ḋß_›3•D⌊=*

Try it Online!Try it Online!

-1 thanks to Steffan.

A different approach that's annoyingly longer. Getting the I/O format right was annoying.

        # Increment
 3•      # Log 3
   u     # Push -1
    ~Ḋ D⌊=  # Check divisibility without popping
      ß_ # If so, pop the -1 andif printit's thean numberinteger
        * # Otherwise, the -1Multiply isby printed.that

Vyxal, 8 bytes

›3•u~Ḋß_

Try it Online!

A different approach that's annoyingly longer. Getting the I/O format right was annoying.

        # Increment
 3•      # Log 3
   u     # Push -1
    ~Ḋ   # Check divisibility without popping
      ß_ # If so, pop the -1 and print the number
         # Otherwise, the -1 is printed.

Vyxal, 7 bytes

›3•D⌊=*

Try it Online!

-1 thanks to Steffan.

A different approach that's annoyingly longer.

›       # Increment
 3•     # Log 3
   D⌊=  # Check if it's an integer
      * # Multiply by that
Source Link
emanresu A
  • 44.4k
  • 5
  • 101
  • 240

Vyxal, 8 bytes

›3•u~Ḋß_

Try it Online!

A different approach that's annoyingly longer. Getting the I/O format right was annoying.

›        # Increment
 3•      # Log 3
   u     # Push -1
    ~Ḋ   # Check divisibility without popping
      ß_ # If so, pop the -1 and print the number
         # Otherwise, the -1 is printed.