login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A306560 Smallest number of 1's required to build n using +, *, ^ and tetration. 1
1, 2, 3, 4, 5, 5, 6, 5, 5, 6, 7, 7, 8, 8, 8, 5, 6, 7, 8, 8, 9, 9, 10, 8, 7, 8, 5, 6, 7, 8, 9, 7, 8, 8, 9, 7, 8, 9, 10, 10, 11, 11, 10, 11, 10, 11, 12, 8, 8, 9, 9, 10, 11, 7, 8, 8, 9, 9, 10, 10, 11, 11, 11, 7, 8, 9, 10, 10, 11, 11, 12, 9, 10, 10, 10, 11, 12, 11, 12, 10, 7, 8, 9, 9, 10, 11, 10 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
LINKS
EXAMPLE
a(16) = 5 because 16 = (1+1)^^(1+1+1). (Note that 16 is also the smallest index at which this sequence differs from A025280.)
a(34) = 8 because 34 = ((1+1)^^(1+1+1)+1)*(1+1). - Jens Ahlström, Jan 11 2023
PROG
(Python)
from functools import lru_cache
from sympy import factorint, divisors
tetration = {2**2**2: 5, 2**2**2**2: 6, 3**3: 5, 4**4: 6, 5**5: 7}
@lru_cache(maxsize=None)
def a(n):
res = n
if n < 6:
return res
if n in tetration:
return tetration[n]
for i in range(1, n):
res = min(res, a(i) + a(n-i))
for d in [i for i in divisors(n) if i not in {1, n}]:
res = min(res, a(d) + a(n//d))
factors = factorint(n)
exponents = set(factors.values())
if len(exponents) == 1:
e = exponents.pop()
if e > 1:
res = min(res, a(sum(factors.keys())) + a(e))
return res
# Jens Ahlström, Jan 11 2023
CROSSREFS
Sequence in context: A323727 A348089 A091334 * A025280 A365092 A096365
KEYWORD
nonn
AUTHOR
Robin Powell, Feb 23 2019
EXTENSIONS
a(34) onward corrected by Jens Ahlström, Jan 11 2023
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 00:30 EDT 2024. Contains 371917 sequences. (Running on oeis4.)