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!)
A071603 Number of different positive integers that we can obtain from the integers {1,2,...,n} using each number at most once and the operators +, -, *, /, where intermediate subexpressions must be integers. 0
1, 3, 9, 31, 121, 542, 2868, 16329, 106762, 758155, 6142570 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
LINKS
EXAMPLE
a(4)=31 because we can obtain the positive integers 1,2,...,28 and 30,32,36 by using the integers {1, 2, 3, 4} at most once and the four operations. For example 30 = 3*2*(4+1).
PROG
(Python)
def a(n):
R = dict() # index of each reachable subset is [card(s)-1][s]
for i in range(n): R[i] = dict()
for i in range(1, n+1): R[0][(i, )] = {i}
reach = set(range(1, n+1))
for j in range(1, n):
for i in range((j+1)//2):
for s1 in R[i]:
for s2 in R[j-1-i]:
if set(s1) & set(s2) == set():
s12 = tuple(sorted(set(s1) | set(s2)))
if s12 not in R[len(s12)-1]:
R[len(s12)-1][s12] = set()
for a in R[i][s1]:
for b in R[j-1-i][s2]:
allowed = [a+b, a*b, a-b, b-a]
if a!=0 and b%a==0: allowed.append(b//a)
if b!=0 and a%b==0: allowed.append(a//b)
R[len(s12)-1][s12].update(allowed)
reach.update(allowed)
return len(set(r for r in reach if r > 0 and r.denominator == 1))
print([a(n) for n in range(1, 9)]) # Michael S. Branicky, Jul 01 2022
CROSSREFS
Sequence in context: A086616 A040027 A182968 * A349970 A090595 A027040
KEYWORD
more,nonn
AUTHOR
Koksal Karakus (karakusk(AT)hotmail.com), Jun 02 2002
EXTENSIONS
a(10)-a(11) from Michael S. Branicky, Jul 01 2022
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 19 15:11 EDT 2024. Contains 371794 sequences. (Running on oeis4.)