Skip to main content
added 429 characters in body
Source Link
loopy walt
  • 16.8k
  • 2
  • 11
  • 69

Python 2, 2927 bytes (@xnor)

f=lambda n:n>n%3/2>-f(n/3) 

Try it online!

Swaps True and False.

Python 2, 29 bytes (@xnor)

f=lambda n:n<1or n%3<2*f(n/3)

Try it online!

Thanks to @Jonathan Allan for convincing me that @xnor's switching to A005836 (without its first element) is actually perfectly good.

Python 2, 31 bytes (@KevinCruijssen)

f=lambda n:n<2or n%3>0<f(n/3+1)

Attempt This Online!

Improved logic is inspired by @alephalpha's PARI/GP answer. Could save another two bytes by allowing any nonzero value for True.

Python, 33 bytes

f=lambda n:n<2or n%3and f(n//3+1)

Attempt This Online!

Uses the base 3 characterisation at OEIS. Returns 0 and True.

Python 2, 29 bytes (@xnor)

f=lambda n:n<1or n%3<2*f(n/3)

Try it online!

Thanks to @Jonathan Allan for convincing me that @xnor's switching to A005836 (without its first element) is actually perfectly good.

Python 2, 31 bytes (@KevinCruijssen)

f=lambda n:n<2or n%3>0<f(n/3+1)

Attempt This Online!

Improved logic is inspired by @alephalpha's PARI/GP answer. Could save another two bytes by allowing any nonzero value for True.

Python, 33 bytes

f=lambda n:n<2or n%3and f(n//3+1)

Attempt This Online!

Uses the base 3 characterisation at OEIS. Returns 0 and True.

Python 2, 27 bytes

f=lambda n:n>n%3/2>-f(n/3) 

Try it online!

Swaps True and False.

Python 2, 29 bytes (@xnor)

f=lambda n:n<1or n%3<2*f(n/3)

Try it online!

Thanks to @Jonathan Allan for convincing me that @xnor's switching to A005836 (without its first element) is actually perfectly good.

Python 2, 31 bytes (@KevinCruijssen)

f=lambda n:n<2or n%3>0<f(n/3+1)

Attempt This Online!

Improved logic is inspired by @alephalpha's PARI/GP answer. Could save another two bytes by allowing any nonzero value for True.

Python, 33 bytes

f=lambda n:n<2or n%3and f(n//3+1)

Attempt This Online!

Uses the base 3 characterisation at OEIS. Returns 0 and True.

added 548 characters in body
Source Link
loopy walt
  • 16.8k
  • 2
  • 11
  • 69

Python 2, 3129 bytes (@KevinCruijssen@xnor)

f=lambda n:n<1or n%3<2*f(n/3)

Try it online!

Thanks to @Jonathan Allan for convincing me that @xnor's switching to A005836 (without its first element) is actually perfectly good.

Python 2, 31 bytes (@KevinCruijssen)

f=lambda n:n<2or n%3>0<f(n/3+1)

Attempt This Online!

Improved logic is inspired by @alephalpha's PARI/GP answer. Could save another two bytes by allowing any nonzero value for True.

Python, 33 bytes

Python, 33 bytes

f=lambda n:n<2or n%3and f(n//3+1)

Attempt This Online!

Uses the base 3 characterisation at OEIS. Returns 0 and True.

Python 2, 31 bytes (@KevinCruijssen)

f=lambda n:n<2or n%3>0<f(n/3+1)

Attempt This Online!

Improved logic is inspired by @alephalpha's PARI/GP answer. Could save another two bytes by allowing any nonzero value for True.

Python, 33 bytes

f=lambda n:n<2or n%3and f(n//3+1)

Attempt This Online!

Uses the base 3 characterisation at OEIS. Returns 0 and True.

Python 2, 29 bytes (@xnor)

f=lambda n:n<1or n%3<2*f(n/3)

Try it online!

Thanks to @Jonathan Allan for convincing me that @xnor's switching to A005836 (without its first element) is actually perfectly good.

Python 2, 31 bytes (@KevinCruijssen)

f=lambda n:n<2or n%3>0<f(n/3+1)

Attempt This Online!

Improved logic is inspired by @alephalpha's PARI/GP answer. Could save another two bytes by allowing any nonzero value for True.

Python, 33 bytes

f=lambda n:n<2or n%3and f(n//3+1)

Attempt This Online!

Uses the base 3 characterisation at OEIS. Returns 0 and True.

added 528 characters in body
Source Link
loopy walt
  • 16.8k
  • 2
  • 11
  • 69

Python 2, 31 bytes (@KevinCruijssen)

f=lambda n:n<2or n%3>0<f(n/3+1)

Attempt This Online!

Improved logic is inspired by @alephalpha's PARI/GP answer. Could save another two bytes by allowing any nonzero value for True.

Python, 33 bytes

f=lambda n:n<2or n%3and f(n//3+1)

Attempt This Online!

Uses the base 3 characterisation at OEIS. Returns 0 and True.

Python, 33 bytes

f=lambda n:n<2or n%3and f(n//3+1)

Attempt This Online!

Uses the base 3 characterisation at OEIS. Returns 0 and True.

Python 2, 31 bytes (@KevinCruijssen)

f=lambda n:n<2or n%3>0<f(n/3+1)

Attempt This Online!

Improved logic is inspired by @alephalpha's PARI/GP answer. Could save another two bytes by allowing any nonzero value for True.

Python, 33 bytes

f=lambda n:n<2or n%3and f(n//3+1)

Attempt This Online!

Uses the base 3 characterisation at OEIS. Returns 0 and True.

added 27 characters in body
Source Link
loopy walt
  • 16.8k
  • 2
  • 11
  • 69
Loading
Source Link
loopy walt
  • 16.8k
  • 2
  • 11
  • 69
Loading