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-4 of 4 results.

A025280 Complexity of n: number of 1's required to build n using +, *, and ^.

Original entry on oeis.org

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

Views

Author

Keywords

References

  • R. K. Guy, Unsolved Problems Number Theory, Sect. F26.

Crossrefs

Cf. A005245 (variant using + and *), A091333 (using +, -, and *), A091334 (using +, -, *, and ^), A348089 (using +, -, *, /, and ^), A348262 (using + and ^).

Programs

  • Maple
    with(numtheory):
    a:= proc(n) option remember; `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(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..100);  # Alois P. Heinz, Mar 08 2013
  • Mathematica
    root[x_, n_] := With[{f = FactorInteger[x]}, Times @@ (f[[All, 1]]^(f[[All, 2]]/n))]; Clear[a]; a[n_] := a[n] = If[n == 1, 1, Min[Table[a[i] + a[n-i], {i, 1, n-1}], Table[a[d] + a[n/d], {d, Divisors[n][[2 ;; -2]]}], Table[a[root[n, p]] + a[p], {p, DeleteCases[Divisors[GCD @@ FactorInteger[n][[All, 2]]], 0|1]}]]]; Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Mar 12 2014, after Alois P. Heinz *)
  • Python
    from math import gcd
    from sympy import divisors, factorint, integer_nthroot
    from functools import cache
    @cache
    def a(n):
        if n == 1: return 1
        p = min(a(i)+a(n-1) for i in range(1, n//2+1))
        divs, m = divisors(n), n
        if len(divs) > 2:
            m = min(a(d)+a(n//d) for d in divs[1:len(divs)//2+1])
        f = factorint(n)
        edivs, e = divisors(gcd(*f.values())), n
        if len(edivs) > 1:
            e = min(a(integer_nthroot(n, r)[0])+a(r) for r in edivs[1:])
        return min(p, m, e)
    print([a(n) for n in range(1, 88)]) # Michael S. Branicky, Mar 24 2024 after Alois P. Heinz

Formula

a(n) = A005208(n) + 1.

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

A002976 Number of certain self-avoiding walks with n steps on square lattice (see reference for precise definition).

Original entry on oeis.org

0, 1, 0, 2, 0, 5, 9, 21, 42, 76, 174, 396, 888, 2023, 4345, 9921, 22566
Offset: 4

Views

Author

Keywords

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Formula

a(n) = A006142(n)+2*A006143(n)+A006144(n). - R. J. Mathar, Oct 22 2007

A319975 Smallest number of complexity n with respect to the operations {1, shift, multiply}.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 10, 11, 14, 19, 22, 23, 38, 43, 58, 59, 89, 107, 134, 167, 179, 263, 347, 383, 537, 713, 719, 1103, 1319, 1439, 2099, 2879, 3833, 4283, 5939, 6299, 9059, 12239, 15118, 19079, 23039, 26459, 44879, 49559, 66239, 78839, 98999, 137339
Offset: 1

Views

Author

N. J. A. Sloane, Oct 11 2018

Keywords

Comments

The shift operation here is also sometimes called successor, see A263283.
Note this complexity measure counts both operands (the ones) and operators (the shifts and multiplications), whereas most of the complexity measures in the crossrefs count only operands. However, in the presence of successor it would not make sense to count only operands, since any number can be expressed with a single occurrence of 1. - Glen Whitney, Oct 06 2021

Examples

			1 = 1 has complexity 1
2 = S1 has complexity 2
3 = SS1 has complexity 3
4 = SSS1 has complexity 4
5 = SSSS1 has complexity 5
6 = SSSSS1 has complexity 6
7 = SSSSSS1 has complexity 7
10 = S*SS1SS1 = shift(product of (3 and 3)) has complexity 8
(Note that 8 = *S1SSS1 has complexity 7)
11 = SS*SS1SS1 has complexity 9
14 = SS*SS1SSS1 has complexity 10
		

Crossrefs

Smallest number of complexity n (other definitions): A003037, A005520, A244743, A259466, and A265360.
Other definitions of the complexity of n: A005208, A005245, A025280, and A099053.

Programs

  • Python
    def aupton(nn):
        alst, R, allR = [1], {1: {1}}, {1} # R[n] is set reachable using n ops
        for n in range(2, nn+1):
            R[n]  = set(a+1 for a in R[n-1])
            R[n] |= set(a*b for i in range(1, (n+1)//2) for a in R[i] for b in R[n-1-i])
            alst.append(min(R[n] - allR))
            allR |= R[n]
        return alst
    print(aupton(49)) # Michael S. Branicky, Oct 06 2021
Showing 1-4 of 4 results.