login
A069765
Number of distinct values obtained using n ones and the operations of sum, product and quotient.
1
1, 2, 4, 7, 13, 24, 42, 77, 138, 249, 454, 823, 1493, 2719, 4969, 9060, 16588, 30375, 55672, 102330, 188334, 346624, 639280, 1179742, 2178907, 4029060, 7456271, 13806301, 25587417, 47452133, 88057540, 163518793, 303826088, 564825654
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
Cf. A048249.
Sequence in context: A096236 A356932 A002574 * A090427 A006745 A049284
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