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.

Previous Showing 51-60 of 60 results.

A306560 Smallest number of 1's required to build n using +, *, ^ and tetration.

Original entry on oeis.org

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

Views

Author

Robin Powell, Feb 23 2019

Keywords

Examples

			a(16) = 5 because 16 = (1+1)^^(1+1+1). (Note that 16 is also the smallest index at which this sequence differs from A025280.)
a(34) = 8 because 34 = ((1+1)^^(1+1+1)+1)*(1+1). - _Jens Ahlström_, Jan 11 2023
		

Crossrefs

Programs

  • Python
    from functools import lru_cache
    from sympy import factorint, divisors
    tetration = {2**2**2: 5, 2**2**2**2: 6, 3**3: 5, 4**4: 6, 5**5: 7}
    @lru_cache(maxsize=None)
    def a(n):
        res = n
        if n < 6:
            return res
        if n in tetration:
            return tetration[n]
        for i in range(1, n):
            res = min(res, a(i) + a(n-i))
        for d in [i for i in divisors(n) if i not in {1, n}]:
            res = min(res, a(d) + a(n//d))
        factors = factorint(n)
        exponents = set(factors.values())
        if len(exponents) == 1:
            e = exponents.pop()
            if e > 1:
                res = min(res, a(sum(factors.keys())) + a(e))
        return res
    # Jens Ahlström, Jan 11 2023

Extensions

a(34) onward corrected by Jens Ahlström, Jan 11 2023

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

A348083 Number of positive numbers that can be built with n ones using +, -, and *, and require at least n ones.

Original entry on oeis.org

1, 1, 1, 1, 2, 3, 2, 6, 6, 8, 13, 18, 21, 35, 45, 61, 90, 121, 162, 241, 323, 450, 638, 865, 1233, 1698, 2349, 3315, 4592, 6382, 8970, 12421, 17351, 24320, 33714, 47218, 65978, 91784, 128177, 179807, 249689, 349549, 489341, 681468, 953769, 1334490, 1860641, 2606043, 3643618, 5086481, 7124229, 9960420
Offset: 1

Views

Author

Glen Whitney, Sep 27 2021

Keywords

Comments

a(n+1)/a(n) appears from the values through n=63 to be oscillating in a narrowing range around 7/5.

Examples

			For n=5, there are two numbers whose minimal expression using 1,+,-, and * uses five ones: 5 = 1+1+1+1+1 and 6 = (1+1)*(1+1+1), so a(5) = 2.
For n=10, there are eight numbers whose minimal expression uses ten ones: 22 = 3(2*3+1)+1, 23 = 2*2*2*3-1, 25 = 5*5, 26 = 3*3*3-1, 28 = 3*3*3+1, 30 = 2*3*5, 32 = 2*2*2*2*2, and 36 = 2*2*3*3. We use numbers k=1..5 in these expressions because each takes k ones to express. Note that n=10 is also the least n for which a(n) differs from A005421(n), which counts the solutions to A005245(k) = n.
		

Crossrefs

Programs

  • Python
    from functools import cache
    @cache
    def f(m):
        if m == 0: return set()
        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])
                    if x != y: out.add(abs(x-y))
        return list(out)
    def a(n): return len(f(n)) - len(f(n-1))
    print([a(n) for n in range(1, 33)]) # Michael S. Branicky, Sep 27 2021

Formula

a(n) = |{k : A091333(k) = n}|.

A363968 Least number of 1's needed to represent n using only additions +, subtractions -, multiplications *, divisions /, concatenations # and parentheses ().

Original entry on oeis.org

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

Views

Author

Bernard Schott, Jun 30 2023

Keywords

Comments

Fractions are not allowed as intermediate results.
The unique difference with A362471 is that concatenation is here allowed; in fact, in A362471, concatenation is only allowed for getting repunits as 111 = 1#1#1 but not for getting other integers.
Also, for example, the concatenation of 5 and -3 is not possible, so it should not be interpreted as 5-3 = 2.
The first differences with A362471 in the data appear at n = 16, 19, 20, 21, 29, ... see Example section.

Examples

			For n = 16, 16 = 1 # ((1+1)*(1+1+1)), so a(16) = 6 while A362471(16) = 7.
For n = 19, 19 = 1 # (11-1-1), so a(19) = 5 while A362471(19) = 6.
For n = 20, 20 = (1+1) # (1-1), so a(20) = 4 while A362471(20) = 5.
For n = 31, 31 = (1+1+1) # (1), so a(31) = 4 while A362471(31) = 7.
For n = 43, 43 = (1+1)*((1+1) # (1)) + 1, so a(43) = 6 while A362471(43) = 7.
		

Crossrefs

Formula

|a(n+1) - a(n)| <= 1; improved by Pontus von Brömssen, Jun 30 2023
a(n) <= A362471(n).
a(n) <= Sum_{k=1..m} a(dk), where d1d2..dm are the decimal digits of n. - Michael S. Branicky, Jun 30 2023

Extensions

a(72) and beyond from Michael S. Branicky, Jun 30 2023

A373446 Number of distinct ways of expressing n using only addition, multiplication (with all factors greater than 1), necessary parentheses, and the number 1.

Original entry on oeis.org

1, 1, 1, 2, 2, 3, 3, 6, 7, 10, 10, 18, 19, 27, 30, 50, 53, 80, 85, 133, 146, 209, 223, 350, 382, 544, 597, 886, 962, 1385, 1507, 2197, 2426, 3422, 3740, 5413, 5941, 8295, 9159, 12994, 14298, 19947, 21982, 30763, 34111, 47005, 51895, 72202, 79974, 109468, 121545, 167032, 185276, 252534, 280427, 382274, 425703, 575650, 640243, 867942
Offset: 1

Views

Author

Daniel W. Grace, Jun 05 2024

Keywords

Comments

Expressions that are the same after commuting their terms are not considered distinct from one another.
Parentheses are used around a sum which is being multiplied, but not otherwise.

Examples

			a(10)=10, as 10 can be expressed in the following ways:
  1+1+1+1+1+1+1+1+1+1
  (1+1)*(1+1)+1+1+1+1+1+1
  (1+1)*(1+1)+(1+1)*(1+1)+1+1
  (1+1)*(1+1)*(1+1)+1+1
  (1+1)*(1+1+1)+1+1+1+1
  (1+1)*(1+1+1)+(1+1)*(1+1)
  (1+1)*(1+1+1+1)+1+1
  (1+1+1)*(1+1+1)+1
  (1+1)*(1+1+1+1+1)
  (1+1)*((1+1)*(1+1)+1).
		

Crossrefs

Programs

  • Python
    from itertools import count,islice
    from collections import Counter
    from math import comb
    from sympy import divisors
    def euler_transform(x):
        xlist = []
        z = []
        y = []
        for n,x in enumerate(x,1):
            xlist.append(x)
            z.append(sum(d*xlist[d-1] for d in divisors(n)))
            yy = (z[-1]+sum(zz*yy for zz,yy in zip(z,reversed(y))))//n
            yield yy
            y.append(yy)
    def factorizations(n,fmin=2):
        if n == 1:
            yield []
            return
        for d in divisors(n,generator=True):
            if d < fmin: continue
            for f in factorizations(n//d,d):
                yield [d]+f
    def A373446_generator():
        alist = []
        def bgen():
            blist = []
            for n in count(1):
                b = 0
                for p in factorizations(n):
                    if len(p) == 1: continue
                    m = 1
                    for k,c in Counter(p).items():
                        m *= comb(alist[k-1]-blist[k-1]+c-1,c)
                    b += m
                yield b
                blist.append(b)
        for a in euler_transform(bgen()):
            yield a
            alist.append(a)
    print(list(islice(A373446_generator(),60))) # Pontus von Brömssen, Jun 13 2024

Formula

a(n) >= a(n-1) since, if "+1" is appended to each expression used to calculate a(n-1), then each of the resulting expressions equate to n and are distinct from each other. There may or may not be other ways to express n that do not include an isolated "+1", hence the greater-than possibility.

A104233 Positive integers which have a "compact" representation using fewer decimal digits than just writing the number normally.

Original entry on oeis.org

125, 128, 216, 243, 256, 343, 512, 625, 729, 1000, 1015, 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1080, 1089, 1125, 1152, 1156, 1215, 1225, 1250, 1280, 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294
Offset: 1

Views

Author

Jack Brennen, Apr 01 2005

Keywords

Comments

You are allowed to use the following symbols as well:
( ) grouping
+ addition
- subtraction
* multiplication
/ division
^ exponentiation
Note that 1015 to 1033 are all representable in the form 4^5-d or 4^5+d, where d is a single digit.
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, Apr 02 2005
From Bernard Schott, Feb 10 2021: (Start)
These numbers are called "entiers compressibles" in French.
There are no 1-digit or 2-digit terms.
The 3-digit terms are all of the form m^q, with 2 <= m, q <= 9.
The 4-digit terms are of the form m^q with m, q > 1, or of the form m^q+-d or m^q*r with m, q, r > 1, d >= 0, and m, q, r, d are all digits (see examples where [...] is a corresponding "compact" representation). (End)

Examples

			From _Bernard Schott_, Feb 10 2021: (Start)
a(1) = 125 = [5^3] = 5*5*5 is the smallest cube.
a(5) = 256 = [2^8] = [4^4] = 16*16 is the smallest square.
a(6) = 343 = [7^3] is the smallest palindrome.
a(15) = 1019 = [4^5-5] is the smallest prime.
6555 = [3^8-5] = [35^2] = T(49) = 49*50/2 is the smallest triangular number.
362880 = 9! = [70*72^2] = [8*(6^6-6^4)] is the smallest factorial.
The smallest zeroless pandigital number 123456789 = [(10^10-91)/81] = [3*(6415^2+38)] is a term. (End)
The largest pandigital number 9876543210 = [(8*10^11+10)/81] = [(8*10^11+10)/9^2] = [5*(15^5+67)*51^2] is also a term. - _Bernard Schott_, Apr 20 2022
		

References

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

Crossrefs

Extensions

More terms from Bernard Schott, Feb 10 2021
Missing terms added by David A. Corneth, Feb 14 2021

A244744 Smallest number with additive excess n.

Original entry on oeis.org

46, 253, 649, 6049, 69989, 166213, 551137, 9064261, 68444596, 347562415, 612220081
Offset: 1

Views

Author

Juan Arias-de-Reyna, Jul 05 2014

Keywords

Comments

Let m = Product p_j ^ a_j be the standard prime factorization of m. The additive excess of m is defined to be Sum||p_j ^ a_j|| - ||m|| where ||m||=A005245(n) is the complexity of n.
The n-th term of this sequence is the least number m with additive excess n.

Examples

			||253||=17, ||11||=8, ||23||=11.  11 + 8 - 17 = 2. The second term is 253.
		

Crossrefs

A346742 Numbers that may be built from fewer ones using floor(j/k) in addition to +, -, and *.

Original entry on oeis.org

1860043, 3198487, 4782847, 5580129, 6111571, 9300217, 9566302, 9595461, 9595462, 9654511, 10678027, 12725059, 12843157, 13551745, 14349271, 14614627, 16740391, 17094685, 18334713, 18334714, 19220449, 27900651, 28698178, 28701094, 29494975, 31620739, 32034081, 33484063, 34100797, 35872267, 37998031
Offset: 1

Views

Author

Glen Whitney, Sep 28 2021

Keywords

Comments

Consider an integer complexity measure c(n) which is the number of ones required to build n using +, -, *, and "floor division" which for convenience will be written in this entry (after Python notation) j//k = floor(j/k). In other words, c(n) is defined identically to A091333(n) except that this floor division is also allowed, and identically to the complexity b(n) described in A348069 except that division is extended to all pairs of natural numbers by taking the floor of the quotient. Clearly for all n, c(n) <= b(n) <= A091333(n). This sequence lists the integers k for which c(k) < A091333(k).
Because of the inequality c(n) <= b(n) <= A091333(n), every entry in A348069 will eventually appear in this sequence. For example, the first term of A348069 is 50221174 = (7*3^15)//2, so we have c(50221174) = 53, b(50221174) = 54, and A091333(50221174) = 55.
The extended domain of division means that terms of this sequence are much more frequent than A348069, but it's still quite rare for division to provide more compact expressions for natural numbers (except in the presence of exponentiation, see A348089).

Examples

			The smallest n for which c(n) as defined in the comments is strictly less than A091333(n) is 1860043, because 1860043 = (7*3^12)//2 which requires c(7) + 12*c(3) + c(2) = 6 + 12*3 + 2 = 44 ones to express with these operations, whereas A091333(1860043) = A005245(1860043) = 45 by virtue of the minimal expression 1860043 = 2(2^2*5*7(3^4(3^4+1)+1)+1)+1 requiring 2+2*2+5+6+3*4+3*4+1+1+1+1 = 45 ones. Hence, the first term in this sequence is 1860043.
The next three terms with their respective minimal expressions:
3198487 = (3^9(2^2*3^4+1))//2 [46 ones] = 2*3(3^2(2^2*3*5+1)(2^2*3^5-1)+2)+1 [47 ones] = 2*3(2(7(2^2*3+1)(2^2*3(3^5+1)+1)+1)+1)+1 [48 ones]. Thus n=319487 is the least n for which c(n) < A091333(n) < A005245(n).
4782847 = (3^5(2*3^9-1))//2 [47 ones] = 2*3(2*5(3^2(2^2*3^3(3^4+1)+1)+1)+1)+1 [48 ones]
5580129 = 3*1860043 = 3((7*3^12)//2) [47 ones] = 2^3(3*5*7(3^4(3^4+1)+1)+1)+1 [48 ones]. Note this example critically takes advantage of the fact that * and // are not associative.
		

Crossrefs

Cf. A253177 and A348069.
Cf. A091333 and A005245 (other integer complexity measures).

A373701 Extension of Mahler-Popken complexity to the rationals. The minimal number of 1's required to build the n-th positive rational in the Cantor ordering using only +, /, and *.

Original entry on oeis.org

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

Views

Author

Adil Soubki, Jun 13 2024

Keywords

Comments

Since we do not require that rationals with denominator 1 be written in the form p/q (i.e., we allow them to be written as p), this reduces to A005245 in the case where q = 1.

Examples

			|    | rational   |  minimal expression         |    a(n) |
|---:|:-----------|:----------------------------|--------:|
|  1 | 1/1        | 1                           |       1 |
|  2 | 1/2        | 1/(1+1)                     |       3 |
|  3 | 2/1        | 1+1                         |       2 |
|  4 | 1/3        | 1/(1+1+1)                   |       4 |
|  5 | 3/1        | 1+1+1                       |       3 |
|  6 | 1/4        | 1/(1+1+1+1)                 |       5 |
|  7 | 2/3        | (1+1)/(1+1+1)               |       5 |
|  8 | 3/2        | 1+(1/(1+1))                 |       4 |
|  9 | 4/1        | 1+1+1+1                     |       4 |
| 10 | 1/5        | 1/(1+1+1+1+1)               |       6 |
| 11 | 5/1        | 1+1+1+1+1                   |       5 |
| 12 | 1/6        | 1/((1+1)*(1+1+1))           |       6 |
| 13 | 2/5        | (1+1)/(1+1+1+1+1)           |       7 |
| 14 | 3/4        | (1+1+1)/(1+1+1+1)           |       7 |
| 15 | 4/3        | 1+(1/(1+1+1))               |       5 |
| 16 | 5/2        | 1+1+(1/(1+1))               |       5 |
| 17 | 6/1        | (1+1)*(1+1+1)               |       5 |
| 18 | 1/7        | 1/((1+1+1)*(1+1) +1)        |       7 |
| 19 | 3/5        | (1+1+1)/(1+1+1+1+1)         |       8 |
| 20 | 5/3        | 1+((1+1)/(1+1+1))           |       6 |
| 21 | 7/1        | (1+1)*(1+1+1)+1             |       6 |
| 22 | 1/8        | 1/((1+1)*(1+1)*(1+1))       |       7 |
| 23 | 2/7        | (1+1)/((1+1)*(1+1+1)+1)     |       8 |
| 24 | 4/5        | (1+1+1+1)/(1+1+1+1+1)       |       9 |
| 25 | 5/4        | 1+(1/(1+1+1+1))             |       6 |
| 26 | 7/2        | 1+1+1+(1/(1+1))             |       6 |
| 27 | 8/1        | (1+1)*(1+1)*(1+1)           |       6 |
| 28 | 1/9        | 1/((1+1+1)*(1+1+1))         |       7 |
| 29 | 3/7        | (1+1+1)/((1+1+1)*(1+1) +1)  |       9 |
| 30 | 7/3        | 1+1+(1/(1+1+1))             |       6 |
| 31 | 9/1        | (1+1+1)*(1+1+1)             |       6 |
| 32 | 1/10       | 1/((1+1+1)*(1+1+1)+1)       |       8 |
| 33 | 2/9        | (1+1)/((1+1+1)*(1+1+1))     |       8 |
| 34 | 3/8        | (1+1+1)/((1+1)*(1+1)*(1+1)) |       9 |
| 35 | 4/7        | (1+1+1+1)/((1+1)*(1+1+1)+1) |      10 |
| 36 | 5/6        | (1/(1+1))+(1/(1+1+1))       |       7 |
| 37 | 6/5        | 1+(1/(1+1+1+1+1))           |       7 |
		

Crossrefs

Cf. A005245 (Mahler-Popken complexity).
Ordering used: A020652 (Cantor numerators), A020653 (Cantor denominators).

A382685 a(n) is the least integer k requiring any combination of at least n 1's or 2's to build using + and *.

Original entry on oeis.org

1, 3, 5, 7, 11, 19, 23, 43, 59, 107, 173, 283, 383, 719, 1103, 1439, 3019, 4283, 8563, 14207, 20719, 31667, 52919, 105838, 165749, 290219, 495359, 880799, 1529279, 2417399, 4085639, 6973259
Offset: 1

Views

Author

Zhining Yang, Jun 02 2025

Keywords

Comments

Of the first 30 terms, all except a(1) and a(24) are primes.

Examples

			a(6) = 19 because 19 = 1 + (2 + 2 * 2 * 2 * 2 ), and 19 cannot be built with five 1 and 2's.
a(10) = 107 because 107 = 1 + (2 + 2 * 2 * (2 + 2 * 2 * (2 + 2 * 2 ))), and 107 cannot be built with nine 1 and 2's.
		

Crossrefs

Programs

  • Maple
    N:= 10^6: # for terms <= N
    M[1]:= {1,2}: T[1]:= M[1]: A:= 1:
    for n from 2 do
      M[n]:= `union`(seq({seq(seq(x+y, x = select(`<=`,M[i],N-y)),y=M[n-i])},i=1..n/2),
                     seq({seq(seq(x*y, x = select(`<=`,M[i],N/y)),y=M[n-i])},i=1..n/2)) minus T[n-1];
      T[n]:= T[n-1] union M[n];
      if M[n] = {} then break fi;
      A:= A, min(M[n]);
    od:
    A; # Robert Israel, Jun 09 2025
  • Mathematica
    num=1500;
    b=Array[99999&,num];a={};
    b[[1]]=b[[2]]=1;
    r=1;
    Do[Do[s=b[[k]]+b[[n/k]];If[s
    				

Extensions

a(28)-a(32) from Hongyang Cao, Jun 10 2025
Previous Showing 51-60 of 60 results.