|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
LINKS
|
|
|
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))
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,more
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|