Skip to main content
deleted 1 character in body
Source Link
xnor
  • 146.6k
  • 26
  • 279
  • 652

Python 3, 48 bytes

f=lambda n:n>1and-max~min(~i-fi+f(n/i)for i in b"")

Try it online!Try it online!

50 bytes

f=lambda n:n>1and min(i+1+f(n/i)for i in[2,3,4,5])

Try it online!

Doesn't bother with the formula. Instead, implements the characterization from the math SE post where each step creates 2, 3, 4, or 5 copies of the strings for that many operations plus one.

The outputs don't match the formula-derived test cases on powers of 4, but as Bubbler points out, this is due to a typo in the formula in the math SE post.

Python 3, 48 bytes

f=lambda n:n>1and-max(~i-f(n/i)for i in b"")

Try it online!

50 bytes

f=lambda n:n>1and min(i+1+f(n/i)for i in[2,3,4,5])

Try it online!

Doesn't bother with the formula. Instead, implements the characterization from the math SE post where each step creates 2, 3, 4, or 5 copies of the strings for that many operations plus one.

The outputs don't match the formula-derived test cases on powers of 4, but as Bubbler points out, this is due to a typo in the formula in the math SE post.

Python 3, 48 bytes

f=lambda n:n>1and-~min(i+f(n/i)for i in b"")

Try it online!

50 bytes

f=lambda n:n>1and min(i+1+f(n/i)for i in[2,3,4,5])

Try it online!

Doesn't bother with the formula. Instead, implements the characterization from the math SE post where each step creates 2, 3, 4, or 5 copies of the strings for that many operations plus one.

The outputs don't match the formula-derived test cases on powers of 4, but as Bubbler points out, this is due to a typo in the formula in the math SE post.

added 375 characters in body
Source Link
xnor
  • 146.6k
  • 26
  • 279
  • 652

Python 3, 5048 bytes

f=lambda n:n>1and-max(~i-f(n/i)for i in b"")

Try it online!

50 bytes

f=lambda n:n>1and min(-~i+fi+1+f(n/i)for i in[2,3,4,5])

Try it online!Try it online!

Doesn't bother with the formula. Instead, implements the characterization from the math SE post where each step creates 2, 3, 4, or 5 copies of the strings for that many operations plus one.

The outputs don't match the formula-derived test cases on powers of 4, but as Bubbler points out, this is due to a typo in the formula in the math SE post.

We can save 1 byte by writing the bytestring b"" for [2,3,4,5],

Python 3, 50 bytes

f=lambda n:n>1and min(-~i+f(n/i)for i in[2,3,4,5])

Try it online!

Doesn't bother with the formula. Instead, implements the characterization from the math SE post where each step creates 2, 3, 4, or 5 copies of the strings for that many operations plus one.

The outputs don't match the formula-derived test cases on powers of 4, but as Bubbler points out, this is due to a typo in the formula in the math SE post.

We can save 1 byte by writing the bytestring b"" for [2,3,4,5],

Python 3, 48 bytes

f=lambda n:n>1and-max(~i-f(n/i)for i in b"")

Try it online!

50 bytes

f=lambda n:n>1and min(i+1+f(n/i)for i in[2,3,4,5])

Try it online!

Doesn't bother with the formula. Instead, implements the characterization from the math SE post where each step creates 2, 3, 4, or 5 copies of the strings for that many operations plus one.

The outputs don't match the formula-derived test cases on powers of 4, but as Bubbler points out, this is due to a typo in the formula in the math SE post.

added 69 characters in body
Source Link
xnor
  • 146.6k
  • 26
  • 279
  • 652

Python 3, 50 bytes

f=lambda n:n>1and min(-~i+f(n/i)for i in[2,3,4,5])

Try it online!

Doesn't bother with the formula. Instead, implements the characterization from the math SE post where each step creates 2, 3, 4, or 5 copies of the strings for that many operations plus one.

The outputs don't match the formula-derived test cases on powers of 4, but as Bubbler points out, this is due to a typo in the formula in the math SE post.

We can save 1 byte by writing the bytestring b"" for [2,3,4,5],

Python 3, 50 bytes

f=lambda n:n>1and min(-~i+f(n/i)for i in[2,3,4,5])

Try it online!

Doesn't bother with the formula. Instead, implements the characterization from the math SE post where each step creates 2, 3, 4, or 5 copies of the strings for that many operations plus one.

The outputs don't match the formula-derived test cases on powers of 4, but as Bubbler points out, this is due to a typo in the formula in the math SE post.

Python 3, 50 bytes

f=lambda n:n>1and min(-~i+f(n/i)for i in[2,3,4,5])

Try it online!

Doesn't bother with the formula. Instead, implements the characterization from the math SE post where each step creates 2, 3, 4, or 5 copies of the strings for that many operations plus one.

The outputs don't match the formula-derived test cases on powers of 4, but as Bubbler points out, this is due to a typo in the formula in the math SE post.

We can save 1 byte by writing the bytestring b"" for [2,3,4,5],

Source Link
xnor
  • 146.6k
  • 26
  • 279
  • 652
Loading