cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-3 of 3 results.

A003037 Smallest number of complexity n: smallest number requiring n 1's to build using +, * and ^.

Original entry on oeis.org

1, 2, 3, 4, 5, 7, 11, 13, 21, 23, 41, 43, 71, 94, 139, 211, 215, 431, 863, 1437, 1868, 2855, 5737, 8935, 15838, 15839, 54357, 95597, 139117, 233195, 470399, 1228247, 2183791, 4388063, 6945587, 13431919, 32329439, 46551023
Offset: 1

Views

Author

Keywords

Comments

The complexity of an integer n is the least number of 1's needed to represent it using only additions, multiplications, exponentiation and parentheses. This does not allow juxtaposition of 1's to form larger integers, so for example, 2 = 1+1 has complexity 2, but 11 does not (concatenating two 1's is not an allowed operation). The complexity of a number has been defined in several different ways by different authors. See the Index to the OEIS for other definitions. - Jonathan Vos Post, Oct 20 2007

Examples

			An example (usually nonunique) of the derivation of the first 10 values.
a(1) = 1, the number of 1's in "1."
a(2) = 2, the number of 1's in "1+1 = 2."
a(3) = 3, the number of 1's in "1+1+1 = 3."
a(4) = 4, the number of 1's in "1+1+1+1 = 4."
a(5) = 5, the number of 1's in "1+1+1+1+1 = 5."
a(6) = 7, since there are 6 1's in "((1+1)*(1+1+1))+1 = 7."
a(7) = 11, since there are 7 1's in "((1+1+1)^(1+1))+1+1 = 11."
a(8) = 13, since there are 8 1's in "((1+1+1)*(1+1+1+1))+1 = 13."
a(9) = 21, since there are 9 1's in "(1+1+1)*(((1+1)*(1+1+1))+1) = 21."
a(10) = 23, since there are 10 1's in "1+((1+1)*(((1+1+1)^(1+1))+1+1)) = 23."
		

References

  • W. A. Beyer, M. L. Stein and S. M. Ulam, The Notion of Complexity. Report LA-4822, Los Alamos Scientific Laboratory of the University of California, Los Alamos, NM, December 1971.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Maple
    xmax:= 5:  # get terms <= 10^xmax
    C[1]:= {1}: A[1]:= 1: CU[1]:= {1}:
    for n from 2 do
       C[n]:= {seq(seq(seq(op(select(`<=`,
    [a+b,a*b,`if`(b*ilog10(a) <= xmax,a^b,NULL),`if`(a*ilog10(b) <= xmax,b^a,NULL)]
             ,10^xmax)),b=C[n-k]),a=C[k]),k=1..floor(n/2))}
             minus CU[n-1];
       if C[n] = {} then break fi;
       A[n]:= min(C[n]);
       CU[n]:= CU[n-1] union C[n];
    od:
    seq(A[i],i=1..n-1); # Robert Israel, Jan 08 2015

Extensions

More terms from David W. Wilson, May 15 1997
More terms from Sean A. Irvine, Jan 07 2015

A182002 Smallest positive integer that cannot be computed using exactly n n's, the four basic arithmetic operations (+, -, *, /), and the parentheses.

Original entry on oeis.org

2, 2, 1, 10, 13, 22, 38, 91, 195, 443, 634, 1121, 3448, 6793, 17692
Offset: 1

Views

Author

Ali Dasdan, Apr 05 2012

Keywords

Examples

			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.
		

Crossrefs

Programs

  • 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
  • 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

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

A133344 Complexity of the number n, counting 1's and built using +, *, ^ and # representing concatenation.

Original entry on oeis.org

1, 2, 3, 4, 5, 5, 6, 5, 5, 6, 2, 3, 4, 5, 6, 6, 7, 6, 6, 7, 3, 4, 5, 5, 6, 6, 6, 7, 7, 8, 4, 5, 5, 6, 7, 6, 7, 8, 7, 8, 5, 5, 6, 6, 7, 7, 8, 7, 8, 8, 6, 7, 7, 8, 7, 8, 9, 9, 9, 8, 6, 6, 6, 7, 8, 7, 8, 8, 8, 9, 7, 8, 8, 8, 9, 10, 8, 9, 10, 10, 6, 7, 8, 7, 8, 8
Offset: 1

Views

Author

Jonathan Vos Post, Oct 20 2007

Keywords

Comments

The complexity of an integer n is the least number of 1's needed to represent it using only additions, multiplications, exponentiation and parentheses. This allows juxtaposition of numbers to form larger integers, so for example, 2 = 1+1 has complexity 2, but unlike A003037, so does 11 = 1#1 (concatenating two numbers is an allowed operation). Similarly a(111) = 3. The complexity of a number has been defined in several different ways by different authors. See the Index to the OEIS for other definitions.

Examples

			An example (usually nonunique) of the derivation of the first 22 values.
a(1) = 1, the number of 1's in "1."
a(2) = 2, the number of 1's in "1+1 = 2."
a(3) = 3, the number of 1's in "1+1+1 = 3."
a(4) = 4, the number of 1's in "1+1+1+1 = 4."
a(5) = 5, the number of 1's in "1+1+1+1+1 = 5."
a(6) = 5, since there are 5 1's in "((1+1)*(1+1+1)) = 6."
a(7) = 6, since there are 6 1's in "1+(((1+1)*(1+1+1))) = 7."
a(8) = 5, since there are 5 1's in "(1+1)^(1+1+1) = 8."
a(9) = 5, since there are 5 1's in "(1+1+1)^(1+1) = 9."
a(10) = 6 since there are 6 1's in "1+((1+1+1)^(1+1)) = ten.
a(11) = 2 since there are 2 1's in "1#1 = eleven."
a(12) = 3 since there are 3 1's in "1+(1#1) = twelve."
a(13) = 4 since there are 4 1's in "1+1+(1#1) = thirteen."
a(14) = 5 since there are 5 1's in "1+1+1+(1#1) = fourteen."
a(16) = 6 since there are 6 1's in "(1+1+1+1)^(1+1)."
a(17) = 7 since there are 7 1's in "1+((1+1+1+1)^(1+1))."
a(18) = 6 since there are 6 1's in "1#((1+1)^(1+1+1))."
a(19) = 6 since there are 6 1's in "1#((1+1+1)^(1+1))."
a(20) = 7 since there are 7 1's in "(1#1)+((1+1+1)^(1+1))."
a(21) = 3 since there are 3 1's in "(1+1)#1."
a(22) = 4 since 22 = (1+1)*(1#1) = (1#1)+(1#1) = (1+1)#(1+1).
		

Crossrefs

Programs

  • Maple
    with(numtheory):
    a:= proc(n) option remember; local r; `if`(n=1, 1, min(
           seq(a(i)+a(n-i), i=1..n-1),
           seq(a(d)+a(n/d), d=divisors(n) minus {1, n}),
           seq(`if`(cat("", n)[i+1]<>"0", a(iquo(n, 10^(length(n)-i),
               'r'))+a(r), NULL), i=1..length(n)-1),
           seq(a(root(n, p))+a(p), p=divisors(igcd(seq(i[2],
               i=ifactors(n)[2]))) minus {0, 1})))
        end:
    seq(a(n), n=1..120);  # Alois P. Heinz, Nov 06 2013
Showing 1-3 of 3 results.