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!)
A066409 Least positive integer not representable using exactly n 9's and the operations +-*/(). 0
1, 2, 1, 4, 13, 22, 33, 103, 195, 381, 934, 1858, 3747, 9166, 31279 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
This sequence allows fractions as intermediate results; else, a(9) would equal 138. - Michael S. Branicky, Feb 08 2023
LINKS
Joe K. Crump, The 9 Nines
EXAMPLE
a(4)=4 because 4 cannot be expressed with exactly 4 nines and the operations +-*/(). E.g. 1 = 9/9+9-9, 2 = 9/9+9/9, 3 = (9+9+9)/9, but 4 has no such representation.
138 = (((9 - (9 / ((9 + 9) + 9))) * (9 + 9)) - 9) - 9.
265 = ((((9 - (9 / (9 + 9))) + 9) + 9) * ((9 * 9) + 9)) / 9.
PROG
(Python)
from fractions import Fraction
from functools import lru_cache
def a(n):
@lru_cache()
def f(m):
if m == 1: return {9}
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, Feb 08 2023
CROSSREFS
Sequence in context: A225117 A088624 A309878 * A006173 A102055 A232376
KEYWORD
more,nonn
AUTHOR
Joe K. Crump (joecr(AT)carolina.rr.com), Dec 24 2001
EXTENSIONS
Corrected by Leonhard Vogt (leonhard.vogt(AT)gmx.ch), Jan 09 2006
a(11)-a(13) from Michael S. Branicky, Feb 08 2023
a(14)-a(15) from Michael S. Branicky, Aug 03 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 27 02:24 EDT 2024. Contains 372004 sequences. (Running on oeis4.)