OFFSET
1,2
EXAMPLE
a(5)=13 because five ones yield the following 13 distinct values and no others: 1+1+1+1+1=5, 1+1+1+(1/1)=4, 1/(1+1+1+1)=1/4, 1+(1/1)+(1/1)=3, 1/(1+1+(1/1))=1/3, 1+(1/(1+1+1))=4/3, 1+(1/1)*(1/1)=2, 1/((1/1)+(1/1))=1/2, (1+1+1)/(1+1)=3/2, 1+1+(1/(1+1))=5/2, (1+1)/(1+1+1)=2/3, 1*1*1*1*1=1 and (1+1)*(1+1+1)=6.
PROG
(Python)
from fractions import Fraction
from functools import lru_cache
@lru_cache()
def f(m):
if m == 1: return {Fraction(1, 1)}
out = set()
for j in range(1, m//2+1):
for x in f(j):
for y in f(m-j):
out.update([x + y, x * y])
if y: out.add(Fraction(x, y))
if x: out.add(Fraction(y, x))
return out
def a(n): return len(f(n))
print([a(n) for n in range(1, 16)]) # Michael S. Branicky, Jul 28 2022
CROSSREFS
KEYWORD
nonn,more
AUTHOR
John W. Layman, Apr 05 2002
EXTENSIONS
a(20)-a(30) from Michael S. Branicky, Jul 29 2022
a(31)-a(34) from Michael S. Branicky, Jun 30 2023
STATUS
approved