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-10 of 31 results. Next

A000792 a(n) = max{(n - i)*a(i) : i < n}; a(0) = 1.

Original entry on oeis.org

1, 1, 2, 3, 4, 6, 9, 12, 18, 27, 36, 54, 81, 108, 162, 243, 324, 486, 729, 972, 1458, 2187, 2916, 4374, 6561, 8748, 13122, 19683, 26244, 39366, 59049, 78732, 118098, 177147, 236196, 354294, 531441, 708588, 1062882, 1594323, 2125764, 3188646, 4782969, 6377292
Offset: 0

Views

Author

Keywords

Comments

Numbers of the form 3^k, 2*3^k, 4*3^k with a(0) = 1 prepended.
If a set of positive numbers has sum n, this is the largest value of their product.
In other words, maximum of products of partitions of n: maximal value of Product k_i for any way of writing n = Sum k_i. To find the answer, take as many of the k_i's as possible to be 3 and then use one or two 2's (see formula lines below).
a(n) is also the maximal size of an Abelian subgroup of the symmetric group S_n. For example, when n = 6, one of the Abelian subgroups with maximal size is the subgroup generated by (123) and (456), which has order 9. [Bercov and Moser] - Ahmed Fares (ahmedfares(AT)my-deja.com), Apr 19 2001
Also the maximum number of maximal cliques possible in a graph with n vertices (cf. Capobianco and Molluzzo). - Felix Goldberg (felixg(AT)tx.technion.ac.il), Jul 15 2001 [Corrected by Jim Nastos and Tanya Khovanova, Mar 11 2009]
Every triple of alternate terms {3*k, 3*k+2, 3*k+4} in the sequence forms a geometric progression with first term 3^k and common ratio 2. - Lekraj Beedassy, Mar 28 2002
For n > 4, a(n) is the least multiple m of 3 not divisible by 8 for which omega(m) <= 2 and sopfr(m) = n. - Lekraj Beedassy, Apr 24 2003
Maximal number of divisors that are possible among numbers m such that A080256(m) = n. - Lekraj Beedassy, Oct 13 2003
Or, numbers of the form 2^p*3^q with p <= 2, q >= 0 and 2p + 3q = n. Largest number obtained using only the operations +,* and () on the parts 1 and 2 of any partition of n into these two summands where the former exceeds the latter. - Lekraj Beedassy, Jan 07 2005
a(n) is the largest number of complexity n in the sense of A005520 (A005245). - David W. Wilson, Oct 03 2005
a(n) corresponds also to the ultimate occurrence of n in A001414 and thus stands for the highest number m such that sopfr(m) = n, for n >= 2. - Lekraj Beedassy, Apr 29 2002
a(n) for n >= 1 is a paradigm shift sequence with procedural length p = 0, in the sense of A193455. - Jonathan T. Rowell, Jul 26 2011
a(n) = largest term of n-th row in A212721. - Reinhard Zumkeller, Jun 14 2012
For n >= 2, a(n) is the largest number whose prime divisors (with multiplicity) add to n, whereas the smallest such number (resp. smallest composite number) is A056240(n) (resp. A288814(n)). - David James Sycamore, Nov 23 2017
For n >= 3, a(n+1) = a(n)*(1 + 1/s), where s is the smallest prime factor of a(n). - David James Sycamore, Apr 10 2018

Examples

			a{8} = 18 because we have 18 = (8-5)*a(5) = 3*6 and one can verify that this is the maximum.
a(5) = 6: the 7 partitions of 5 are (5), (4, 1), (3, 2), (3, 1, 1), (2, 2, 1), (2, 1, 1, 1), (1, 1, 1, 1, 1) and the corresponding products are 5, 4, 6, 3, 4, 2 and 1; 6 is the largest.
G.f. = 1 + x + 2*x^2 + 3*x^3 + 4*x^4 + 6*x^5 + 9*x^6 + 12*x^7 + 18*x^8 + ...
		

References

  • B. R. Barwell, Cutting String and Arranging Counters, J. Rec. Math., 4 (1971), 164-168.
  • B. R. Barwell, Journal of Recreational Mathematics, "Maximum Product": Solution to Prob. 2004;25(4) 1993, Baywood, NY.
  • M. Capobianco and J. C. Molluzzo, Examples and Counterexamples in Graph Theory, p. 207. North-Holland: 1978.
  • S. L. Greitzer, International Mathematical Olympiads 1959-1977, Prob. 1976/4 pp. 18;182-3 NML vol. 27 MAA 1978
  • J. L. Gross and J. Yellen, eds., Handbook of Graph Theory, CRC Press, 2004; p. 396.
  • P. R. Halmos, Problems for Mathematicians Young and Old, Math. Assoc. Amer., 1991, pp. 30-31 and 188.
  • L. C. Larson, Problem-Solving Through Problems. Problem 1.1.4 pp. 7. Springer-Verlag 1983.
  • D. J. Newman, A Problem Seminar. Problem 15 pp. 5;15. Springer-Verlag 1982.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

See A007600 for a left inverse.
Cf. array A064364, rightmost (nonvanishing) numbers in row n >= 2.
See A056240 and A288814 for the minimal numbers whose prime factors sums up to n.
A000792, A178715, A193286, A193455, A193456, and A193457 are closely related as paradigm shift sequences for (p = 0, ..., 5 respectively).
Cf. A202337 (subsequence).

Programs

  • Haskell
    a000792 n = a000792_list !! n
    a000792_list = 1 : f [1] where
       f xs = y : f (y:xs) where y = maximum $ zipWith (*) [1..] xs
    -- Reinhard Zumkeller, Dec 17 2011
    
  • Magma
    I:=[1,1,2,3,4]; [n le 5 select I[n] else 3*Self(n-3): n in [1..45]]; // Vincenzo Librandi, Apr 14 2015
  • Maple
    A000792 := proc(n)
        m := floor(n/3) ;
        if n mod 3 = 0 then
            3^m ;
        elif n mod 3 = 1 then
            4*3^(m-1) ;
        else
            2*3^m ;
        end if;
        floor(%) ;
    end proc: # R. J. Mathar, May 26 2013
  • Mathematica
    a[1] = 1; a[n_] := 4* 3^(1/3 *(n - 1) - 1) /; (Mod[n, 3] == 1 && n > 1); a[n_] := 2*3^(1/3*(n - 2)) /; Mod[n, 3] == 2; a[n_] := 3^(n/3) /; Mod[n, 3] == 0; Table[a[n], {n, 0, 40}]
    CoefficientList[Series[(1 + x + 2x^2 + x^4)/(1 - 3x^3), {x, 0, 50}], x] (* Harvey P. Dale, May 01 2011 *)
    f[n_] := Max[ Times @@@ IntegerPartitions[n, All, Prime@ Range@ PrimePi@ n]]; f[1] = 1; Array[f, 43, 0] (* Robert G. Wilson v, Jul 31 2012 *)
    a[ n_] := If[ n < 2, Boole[ n > -1], 2^Mod[-n, 3] 3^(Quotient[ n - 1, 3] + Mod[n - 1, 3] - 1)]; (* Michael Somos, Jan 23 2014 *)
    Join[{1, 1}, LinearRecurrence[{0, 0, 3}, {2, 3, 4}, 50]] (* Jean-François Alcover, Jan 08 2019 *)
    Join[{1,1},NestList[#+Divisors[#][[-2]]&,2,41]] (* James C. McMahon, Aug 09 2024 *)
  • PARI
    {a(n) = floor( 3^(n - 4 - (n - 4) \ 3 * 2) * 2^( -n%3))}; /* Michael Somos, Jul 23 2002 */
    
  • PARI
    lista(nn) = {print1("1, 1, "); print1(a=2, ", "); for (n=1, nn, a += a/divisors(a)[2]; print1(a, ", "););} \\ Michel Marcus, Apr 14 2015
    
  • PARI
    A000792(n)=if(n>1,3^((n-2)\3)*(2+(n-2)%3),1) \\ M. F. Hasler, Jan 19 2019
    

Formula

G.f.: (1 + x + 2*x^2 + x^4)/(1 - 3*x^3). - Simon Plouffe in his 1992 dissertation.
a(3n) = 3^n; a(3*n+1) = 4*3^(n-1) for n > 0; a(3*n+2) = 2*3^n.
a(n) = 3*a(n-3) if n > 4. - Henry Bottomley, Nov 29 2001
a(n) = n if n <= 2, otherwise a(n-1) + Max{gcd(a(i), a(j)) | 0 < i < j < n}. - Reinhard Zumkeller, Feb 08 2002
A007600(a(n)) = n; Andrew Chi-Chih Yao attributes this observation to D. E. Muller. - Vincent Vatter, Apr 24 2006
a(n) = 3^(n - 2 - 2*floor((n - 1)/3))*2^(2 - (n - 1) mod 3) for n > 1. - Hieronymus Fischer, Nov 11 2007
From Kiyoshi Akima (k_akima(AT)hotmail.com), Aug 31 2009: (Start)
a(n) = 3^floor(n/3)/(1 - (n mod 3)/4), n > 1.
a(n) = 3^(floor((n - 2)/3))*(2 + ((n - 2) mod 3)), n > 1. (End)
a(n) = (2^b)*3^(C - (b + d))*(4^d), n > 1, where C = floor((n + 1)/3), b = max(0, ((n + 1) mod 3) - 1), d = max(0, 1 - ((n + 1) mod 3)). - Jonathan T. Rowell, Jul 26 2011
G.f.: 1 / (1 - x / (1 - x / (1 + x / (1 - x / (1 + x / (1 + x^2 / (1 + x))))))). - Michael Somos, May 12 2012
3*a(n) = 2*a(n+1) if n > 1 and n is not divisible by 3. - Michael Somos, Jan 23 2014
a(n) = a(n-1) + largest proper divisor of a(n-1), n > 2. - Ivan Neretin, Apr 13 2015
a(n) = max{a(i)*a(n-i) : 0 < i < n} for n >= 4. - Jianing Song, Feb 15 2020
a(n+1) = a(n) + A038754(floor( (2*(n-1) + 1)/3 )), for n > 1. - Thomas Scheuerle, Oct 27 2022

Extensions

More terms and better description from Therese Biedl (biedl(AT)uwaterloo.ca), Jan 19 2000

A005245 The (Mahler-Popken) complexity of n: minimal number of 1's required to build n using + and *.

Original entry on oeis.org

1, 2, 3, 4, 5, 5, 6, 6, 6, 7, 8, 7, 8, 8, 8, 8, 9, 8, 9, 9, 9, 10, 11, 9, 10, 10, 9, 10, 11, 10, 11, 10, 11, 11, 11, 10, 11, 11, 11, 11, 12, 11, 12, 12, 11, 12, 13, 11, 12, 12, 12, 12, 13, 11, 12, 12, 12, 13, 14, 12, 13, 13, 12, 12, 13, 13, 14, 13, 14, 13, 14, 12, 13, 13, 13, 13, 14, 13, 14
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 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 ("pasting together" 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.
Guy asks if a(p) = a(p-1) + 1 for prime p. Martin Fuller found the least counterexample p = 353942783 in 2008, see Fuller link. - Charles R Greathouse IV, Oct 04 2012
It appears that this sequence is lower than A348262 {1,+,^} only a finite number of times. - Gordon Hamilton and Brad Ballinger, May 23 2022
The second Altman links proves that {a(n) - 3*log_3(n)} is a well-ordered subset of the reals whose intersection with [0,k) has order type omega^k for each positive integer k, so this set itself has order type omega^omega. - Jianing Song, Apr 13 2024

Examples

			From _Lekraj Beedassy_, Jul 04 2009: (Start)
   n.........minimal expression........ a(n) = number of 1's
   1..................1...................1
   2.................1+1..................2
   3................1+1+1.................3
   4.............(1+1)*(1+1)..............4
   5............(1+1)*(1+1)+1.............5
   6............(1+1)*(1+1+1).............5
   7...........(1+1)*(1+1+1)+1............6
   8..........(1+1)*(1+1)*(1+1)...........6
   9...........(1+1+1)*(1+1+1)............6
  10..........(1+1+1)*(1+1+1)+1...........7
  11.........(1+1+1)*(1+1+1)+1+1..........8
  12.........(1+1)*(1+1)*(1+1+1)..........7
  13........(1+1)*(1+1)*(1+1+1)+1.........8
  14.......{(1+1)*(1+1+1)+1}*(1+1)........8
  15.......{(1+1)*(1+1)+1}*(1+1+1)........8
  16.......(1+1)*(1+1)*(1+1)*(1+1)........8
  17......(1+1)*(1+1)*(1+1)*(1+1)+1.......9
  18........(1+1)*(1+1+1)*(1+1+1).........8
  19.......(1+1)*(1+1+1)*(1+1+1)+1........9
  20......{(1+1+1)*(1+1+1)+1}*(1+1).......9
  21......{(1+1)*(1+1+1)+1}*(1+1+1).......9
  22.....{(1+1)*(1+1+1)+1}*(1+1+1)+1.....10
  23....{(1+1)*(1+1+1)+1}*(1+1+1)+1+1....11
  24......(1+1)*(1+1)*(1+1)*(1+1+1).......9
  25.....(1+1)*(1+1)*(1+1)*(1+1+1)+1.....10
  26....{(1+1)*(1+1)*(1+1+1)+1}*(1+1)....10
  27.......(1+1+1)*(1+1+1)*(1+1+1)........9
  28......(1+1+1)*(1+1+1)*(1+1+1)+1......10
  29.....(1+1+1)*(1+1+1)*(1+1+1)+1+1.....11
  30.....{(1+1+1)*(1+1+1)+1}*(1+1+1).....10
  31....{(1+1+1)*(1+1+1)+1}*(1+1+1)+1....11
  32....(1+1)*(1+1)*(1+1)*(1+1)*(1+1)....10
  33...(1+1)*(1+1)*(1+1)*(1+1)*(1+1)+1...11
  34..{(1+1)*(1+1)*(1+1)*(1+1)+1}*(1+1)..11
  .........................................
(End)
		

References

  • M. Criton, "Les uns de Germain", Problem No. 4, pp. 13 ; 68 in '7 x 7 Enigmes Et Défis Mathématiques pour tous', vol. 25, Editions POLE, Paris 2001.
  • R. K. Guy, Unsolved Problems in Number Theory, Sect. F26.
  • K. Mahler and J. Popken, Over een Maximumprobleem uit de Rekenkunde (Dutch: On a maximum problem in arithmetic), Nieuw Arch. Wiskunde, (3) 1 (1953), pp. 1-15.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A025280 (variant using +, *, and ^), A091333 (using +, -, and *), A091334 (using +, -, *, and ^), A348089 (using +, -, *, / and ^), A348262 (using + and ^).
Cf. A000792 (largest integer of given complexity), A003313, A076142, A076091, A061373, A005421, A064097, A005520, A003037, A161906, A161908, A244743.

Programs

  • Haskell
    import Data.List (genericIndex)
    a005245 n = a005245_list `genericIndex` (n-1)
    a005245_list = 1 : f 2 [1] where
       f x ys = y : f (x + 1) (y : ys) where
         y = minimum $
             (zipWith (+) (take (x `div` 2) ys) (reverse ys)) ++
             (zipWith (+) (map a005245 $ tail $ a161906_row x)
                          (map a005245 $ reverse $ init $ a161908_row x))
    -- Reinhard Zumkeller, Mar 08 2013
    
  • Maple
    with(numtheory):
    a:= proc(n) option remember;
          `if`(n=1, 1, min(seq(a(i)+a(n-i), i=1..n/2),
           seq(a(d)+a(n/d), d=divisors(n) minus {1, n})))
        end:
    seq(a(n), n=1..100); # Alois P. Heinz, Apr 18 2012
  • Mathematica
    a[n_] := a[n] = If[n == 1, 1,
       Min[Table[a[i] + a[n-i], {i, 1, n/2}] ~Join~
       Table[a[d] + a[n/d], {d, Divisors[n] ~Complement~ {1, n}}]]];
    Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Dec 12 2013, after Alois P. Heinz *)
  • PARI
    A005245(n /* start by calling this with the largest needed n */, lim/* see below */) = { local(d); n<6 && return(n);
    if(n<=#A005245, A005245[n]&return(A005245[n]) /* return memoized result if available */,
    A005245=vector(n) /* create vector if needed - should better reuse existing data if available */);
    for(i=1, n-1, A005245[i] || A005245[i]=A005245(i,lim)); /* compute all previous elements */
    A005245[n]=min( vecmin(vector(min(n\2,if(lim>0,lim,n)), k, A005245[k]+A005245[n-k])) /* additive possibilities - if lim>0 is given, consider a(k)+a(n-k) only for k<=lim - we know it is save to use lim=1 up to n=2e7 */, if( isprime(n), n, vecmin(vector((-1+#d=divisors(n))\2, i, A005245[d[i+1]]+A005245[d[ #d-i]]))/* multiplicative possibilities */))}
    \\ See also the Python program by Tim Peters at A005421.
    \\ M. F. Hasler, Jan 30 2008
    
  • Python
    from functools import lru_cache
    from itertools import takewhile
    from sympy import divisors
    @lru_cache(maxsize=None)
    def A005245(n): return min(min(A005245(a)+A005245(n-a) for a in range(1,(n>>1)+1)),min((A005245(d)+A005245(n//d) for d in takewhile(lambda d:d*d<=n,divisors(n)) if d>1),default=n)) if n>1 else 1 # Chai Wah Wu, Apr 29 2023

Formula

It is known that a(n) <= A061373(n) but I think 0 <= A061373(n) - a(n) <= 1 also holds. - Benoit Cloitre, Nov 23 2003 [That's false: the numbers {46, 235, 649, 1081, 7849, 31669, 61993} require {1, 2, 3, 4, 5, 6, 7} fewer 1's in A005245 than in A061373. - Ed Pegg Jr, Apr 13 2004]
It is known from the work of Selfridge and Coppersmith that 3 log_3 n <= a(n) <= 3 log_2 n = 4.754... log_3 n for all n > 1. [Guy, Unsolved Problems in Number Theory, Sect. F26.] - Charles R Greathouse IV, Apr 19 2012 [Comment revised by N. J. A. Sloane, Jul 17 2016]
Zelinsky (2022) improves the upper bound to a(n) <= A*log n where A = 41/log(55296) = 3.754422.... This compares to the constant 2.7307176... of the lower bound. - Charles R Greathouse IV, Dec 11 2022
a(n) >= A007600(n) is a very accurate lower bound. - Mehmet Sarraç, Dec 18 2022

Extensions

More terms from David W. Wilson, May 15 1997

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.

A048249 Number of distinct values produced from sums and products of n unity arguments.

Original entry on oeis.org

1, 2, 3, 4, 6, 9, 11, 17, 23, 30, 44, 60, 80, 114, 156, 212, 296, 404, 556, 770, 1065, 1463, 2032, 2795, 3889, 5364, 7422, 10300, 14229, 19722, 27391, 37892, 52599, 73075, 101301, 140588, 195405, 271024, 376608, 523518, 726812, 1010576, 1405013, 1952498
Offset: 1

Views

Author

Keywords

Comments

Values listed calculated by exhaustive search algorithm.
For n+1 operands (n operations) there are (2n)!/((n!)((n+1)!)) possible postfix forms over a single operator. For each such form, there are 2^n ways to assign 2 operators (here, sum and product). Calculate results and eliminate duplicates.
Number of distinct positive integers that can be obtained by iteratively adding or multiplying together parts of an integer partition until only one part remains, starting with 1^n. - Gus Wiseman, Sep 29 2018

Examples

			a(3)=3 since (in postfix): 111** = 11*1* = 1, 111*+ = 11*1+ = 111+* = 11+1* = 2 and 111++ = 11+1+ = 3. Note that at n=7, the 11 possible values produced are the set {1,2,3,4,5,6,7,8,9,10,12}. This is the first n for which there are "skipped" values in the set.
		

Crossrefs

Programs

  • Maple
    b:= proc(n) option remember; `if`(n=1, {1}, {seq(seq(seq(
         [f+g, f*g][], g=b(n-i)), f=b(i)), i=1..iquo(n, 2))})
        end:
    a:= n-> nops(b(n)):
    seq(a(n), n=1..35);  # Alois P. Heinz, May 05 2019
  • Mathematica
    ReplaceListRepeated[forms_,rerules_]:=Union[Flatten[FixedPointList[Function[pre,Union[Flatten[ReplaceList[#,rerules]&/@pre,1]]],forms],1]];
    Table[Length[Select[ReplaceListRepeated[{Array[1&,n]},{{foe___,x_,mie___,y_,afe___}:>Sort[Append[{foe,mie,afe},x+y]],{foe___,x_,mie___,y_,afe___}:>Sort[Append[{foe,mie,afe},x*y]]}],Length[#]==1&]],{n,10}] (* Gus Wiseman, Sep 29 2018 *)
  • Python
    from functools import cache
    @cache
    def f(m):
        if m == 1: return {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])
        return out
    def a(n): return len(f(n))
    print([a(n) for n in range(1, 40)]) # Michael S. Branicky, Aug 03 2022

Formula

Equals partial sum of "number of numbers of complexity n" (A005421). - Jonathan Vos Post, Apr 07 2006

Extensions

More terms from David W. Wilson, Oct 10 2001
a(43)-a(44) from Alois P. Heinz, May 05 2019

A319910 Number of distinct pairs (m, y), where m >= 1 and y is an integer partition of n, such that m can be obtained by iteratively adding or multiplying together parts of y until only one part (equal to m) remains.

Original entry on oeis.org

1, 3, 6, 11, 23, 48, 85, 178, 331, 619, 1176, 2183, 3876, 7013, 12447, 21719, 37628, 64570, 109723, 185055
Offset: 1

Views

Author

Gus Wiseman, Oct 01 2018

Keywords

Examples

			The a(4) = 11 pairs:
  4 <= (4)
  3 <= (3,1)
  4 <= (3,1)
  4 <= (2,2)
  2 <= (2,1,1)
  3 <= (2,1,1)
  4 <= (2,1,1)
  1 <= (1,1,1,1)
  2 <= (1,1,1,1)
  3 <= (1,1,1,1)
  4 <= (1,1,1,1)
		

Crossrefs

Programs

  • Mathematica
    ReplaceListRepeated[forms_,rerules_]:=Union[Flatten[FixedPointList[Function[pre,Union[Flatten[ReplaceList[#,rerules]&/@pre,1]]],forms],1]];
    nexos[ptn_]:=If[Length[ptn]==0,{0},Union@@Select[ReplaceListRepeated[{Sort[ptn]},{{foe___,x_,mie___,y_,afe___}:>Sort[Append[{foe,mie,afe},x+y]],{foe___,x_,mie___,y_,afe___}:>Sort[Append[{foe,mie,afe},x*y]]}],Length[#]==1&]];
    Table[Total[Length/@nexos/@IntegerPartitions[n]],{n,20}]

A319913 Number of distinct integer partitions whose parts can be combined together using additions and multiplications to obtain n, with the exception that 1's can only be added and not multiplied with other parts.

Original entry on oeis.org

1, 2, 3, 5, 7, 16, 20, 37, 53, 81, 107, 177, 227, 332, 449, 647, 830, 1162, 1480, 2032, 2597, 3447, 4348, 5775, 7251, 9374, 11758, 15026, 18640, 23688, 29220, 36771, 45128, 56168, 68674, 85015, 103394, 126923, 153871, 187911, 226653
Offset: 1

Views

Author

Gus Wiseman, Oct 01 2018

Keywords

Comments

All parts of the integer partition must be used in such a combination.

Examples

			The a(7) = 20 partitions (which are not all partitions of 7):
  (7),
  (61), (52), (43),
  (511), (321), (421), (331), (322),
  (3111), (4111), (2211), (3211), (2221),
  (21111), (31111), (22111),
  (111111), (211111),
  (1111111).
This list contains (2211) because we can write 7 = (2+1)*2+1. It contains (321) because we can write 7 = 3*2+1, even though the sum of parts is only 6.
		

Crossrefs

Formula

a(n) >= A000041(n).
a(n) >= A001055(n).

Extensions

a(13)-a(41) from Charlie Neder, Jun 02 2019

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

A005421 Number of numbers of complexity n, i.e., that can be built from n ones using + and *, and require at least that many ones.

Original entry on oeis.org

1, 1, 1, 1, 2, 3, 2, 6, 6, 7, 14, 16, 20, 34, 42, 56, 84, 108, 152, 214, 295, 398, 569, 763, 1094, 1475, 2058, 2878, 3929, 5493, 7669, 10501, 14707, 20476, 28226, 39287, 54817, 75619, 105584, 146910, 203294, 283764, 394437, 547485, 763821, 1061367, 1476067, 2057708, 2861449
Offset: 1

Views

Author

Keywords

References

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

Crossrefs

Cf. A005245 (complexity of n), A005520 (records).

Programs

  • Mathematica
    terms = 30;
    kmax = 60000;
    cpx[1] = 1; cpx[k_] := cpx[k] = Min[Sequence @@ Table[cpx[i] + cpx[k-i], {i, 1, k/2}], Sequence @@ Table[cpx[d] + cpx[k/d], {d, Divisors[k][[2 ;; -2]]}]];
    Clear[a]; a[_] = 0;
    Do[n = cpx[k]; a[n] += 1, {k, 1, kmax}];
    Array[a, terms] (* Jean-François Alcover, Aug 30 2018 *)

Extensions

More terms from Tim Peters (tim.one(AT)comcast.net), Nov 12 2004
a(43)-a(75) from Janis Iraids, Apr 20 2011
Name clarified by Glen Whitney, Oct 05 2021

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

A181898 Smallest positive integer which cannot be calculated by an expression containing n binary operators (any of add, subtract, multiply and divide) whose operands are any integer between 1 and 9; parentheses allowed.

Original entry on oeis.org

10, 19, 92, 417, 851, 4237, 14771, 73237, 298609
Offset: 0

Views

Author

Derek M. Jones, Apr 03 2012

Keywords

Examples

			a(2)=92 because at least 3 operators are required, e.g., (2*7 + 9)*4.
		

Crossrefs

Cf. A181957, A181958, A181959, A181960, A005520, A048183 (see text of comment).

Programs

  • PARI
    first(n)=my(op=[(x,y)->x+y, (x,y)->x-y, (x,y)->y-x, (x,y)->x*y, (x,y)->x/y, (x,y)->y/x], v=vector(n+1), t); v[1]=[1..9]; for(k=2,#v, my(u=[]); for(i=1,(k+1)\2, my(a=v[i],b=v[k-i]); t=Set(concat(apply(f->setbinop(f,a,b), op))); u=concat(u,t)); v[k]=setminus(Set(u), [0])); t=10; for(i=1,#v, while(setsearch(v[i],t), t++); v[i]=t); v \\ Charles R Greathouse IV, Jan 09 2017
  • R
    See Jones link.
    
Showing 1-10 of 31 results. Next