login
Number of distinct values obtained using n ones and the operations of sum, product and quotient.
1

%I #16 Jun 30 2023 18:33:08

%S 1,2,4,7,13,24,42,77,138,249,454,823,1493,2719,4969,9060,16588,30375,

%T 55672,102330,188334,346624,639280,1179742,2178907,4029060,7456271,

%U 13806301,25587417,47452133,88057540,163518793,303826088,564825654

%N Number of distinct values obtained using n ones and the operations of sum, product and quotient.

%H <a href="/index/Fo#4x4">Index entries for similar sequences</a>

%e 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.

%o (Python)

%o from fractions import Fraction

%o from functools import lru_cache

%o @lru_cache()

%o def f(m):

%o if m == 1: return {Fraction(1, 1)}

%o out = set()

%o for j in range(1, m//2+1):

%o for x in f(j):

%o for y in f(m-j):

%o out.update([x + y, x * y])

%o if y: out.add(Fraction(x, y))

%o if x: out.add(Fraction(y, x))

%o return out

%o def a(n): return len(f(n))

%o print([a(n) for n in range(1, 16)]) # _Michael S. Branicky_, Jul 28 2022

%Y Cf. A048249.

%K nonn,more

%O 1,2

%A _John W. Layman_, Apr 05 2002

%E a(20)-a(30) from _Michael S. Branicky_, Jul 29 2022

%E a(31)-a(34) from _Michael S. Branicky_, Jun 30 2023