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!)
A182002 Smallest positive integer that cannot be computed using exactly n n's, the four basic arithmetic operations (+, -, *, /), and the parentheses. 11
2, 2, 1, 10, 13, 22, 38, 91, 195, 443, 634, 1121, 3448, 6793, 17692 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
LINKS
EXAMPLE
a(2) = 2 because two 2's can produce 0 = 2-2, 1 = 2/2, 4 = 2+2 = 2*2, so the smallest positive integer that cannot be computed is 2.
a(3) = 1 because no expression with three 3's gives 1.
MAPLE
f:= proc(n, b) option remember;
`if`(n=1, {b}, {seq(seq(seq([k+m, k-m, k*m,
`if`(m=0, NULL, k/m)][], m=f(n-i, b)), k=f(i, b)), i=1..n-1)})
end:
a:= proc(n) local i, l;
l:= sort([infinity, select(x-> is(x, integer) and x>0, f(n, n))[]]);
for i do if l[i]<>i then return i fi od
end:
seq(a(n), n=1..8); # Alois P. Heinz, Apr 13 2012
PROG
(Python)
from fractions import Fraction
from functools import lru_cache
def a(n):
@lru_cache()
def f(m):
if m == 1: return {Fraction(n, 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, y - x, x * y])
if y: out.add(Fraction(x, y))
if x: out.add(Fraction(y, x))
return out
k, s = 1, f(n)
while k in s: k += 1
return k
print([a(n) for n in range(1, 10)]) # Michael S. Branicky, Jul 29 2022
CROSSREFS
Sequence in context: A306149 A134896 A105620 * A184251 A262348 A307093
KEYWORD
nonn,more
AUTHOR
Ali Dasdan, Apr 05 2012
EXTENSIONS
a(11)-a(12) from Alois P. Heinz, Apr 22 2012
a(13)-a(14) from Michael S. Branicky, Jul 29 2022
a(15) from Michael S. Branicky, Jul 27 2023
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 25 05:18 EDT 2024. Contains 371964 sequences. (Running on oeis4.)