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 16 results. Next

A056182 First differences of A003063.

Original entry on oeis.org

0, 2, 10, 38, 130, 422, 1330, 4118, 12610, 38342, 116050, 350198, 1054690, 3172262, 9533170, 28632278, 85962370, 258018182, 774316690, 2323474358, 6971471650, 20916512102, 62753730610, 188269580438, 564825518530, 1694510110022, 5083597438930, 15250926534518, 45753048039010
Offset: 0

Views

Author

N. J. A. Sloane, Aug 05 2000

Keywords

Comments

Let V be a binary relation on the power set P(A) of a set A having n = |A| elements such that for every element x, y of P(A), xVy if x is a proper subset of y or y is a proper subset of x. Then a(n) = |V|. - Ross La Haye, Dec 22 2006
With regard to the comment by Ross La Haye: For nonempty subsets see a(n+1) in A260217. - If "proper" is omitted see A027649. - For nonempty subsets with "proper" omitted see A091344. - Manfred Boergens, Sep 04 2023
It appears that a(n) is the number of permutations p of 1,..,(n+2) such that max[p(i+1)-p(i)] is 2. For example, for n=1, the permutations (1,3,2) and (2,1,3) and no others have the desired property, so a(1)=2. This approach gives values in agreement with all listed terms. [John W. Layman, Nov 09 2011]
In the terdragon curve, a(n-1) is the number of enclosed unit triangles in expansion level n. - Kevin Ryde, Oct 20 2020

Crossrefs

3rd column of A056151. Cf. A028243 (partial sums).
A002783(n) - 1.
a(n) = A293181(n+1,3).

Programs

  • Maple
    A056182:=n->2 * (3^n - 2^n); seq(A056182(n), n=0..30); # Wesley Ivan Hurt, Feb 10 2014
  • Mathematica
    Table[ -((-1 + k)^(1-k+n)*(-1+k)!)+k^(-k+n)*k! /. k -> 3, {n, 3, 36} ]
    Table[2 (3^n - 2^n), {n, 0, 30}] (* Wesley Ivan Hurt, Feb 10 2014 *)
    CoefficientList[Series[2 x/((2 x - 1) (3 x - 1)), {x, 0, 40}], x] (* Vincenzo Librandi, Feb 12 2014 *)
    LinearRecurrence[{5,-6},{0,2},30] (* Harvey P. Dale, Sep 22 2015 *)

Formula

a(n) = 2 * (3^n - 2^n).
a(n) = 5*a(n-1)-6*a(n-2). G.f.: 2*x/((2*x-1)*(3*x-1)). [Colin Barker, Dec 10 2012]
a(n) = A217764(n,3). - Ross La Haye, Mar 27 2013
a(n) = sum_{i=1..n} binomial(n, i) * 2^(n - i + 1). - Wesley Ivan Hurt, Feb 10 2014
a(n) = 2 * A001047(n). - Wesley Ivan Hurt, Feb 10 2014
E.g.f.: 2*exp(2*x)*(exp(x) - 1). - Stefano Spezia, May 18 2024

Extensions

More terms from Wouter Meeussen, Aug 05 2000

A001047 a(n) = 3^n - 2^n.

Original entry on oeis.org

0, 1, 5, 19, 65, 211, 665, 2059, 6305, 19171, 58025, 175099, 527345, 1586131, 4766585, 14316139, 42981185, 129009091, 387158345, 1161737179, 3485735825, 10458256051, 31376865305, 94134790219, 282412759265, 847255055011, 2541798719465, 7625463267259, 22876524019505
Offset: 0

Views

Author

Keywords

Comments

a(n+1) is the sum of the elements in the n-th row of triangle pertaining to A036561. - Amarnath Murthy, Jan 02 2002
Number of 2 X n binary arrays with a path of adjacent 1's and no path of adjacent 0's from top row to bottom row. - R. H. Hardin, Mar 21 2002
With offset 1, partial sums of A027649. - Paul Barry, Jun 24 2003
Number of distinct lines through the origin in the n-dimensional lattice of side length 2. A049691 has the values for the 2-dimensional lattice of side length n. - Joshua Zucker, Nov 19 2003
a(n+1)/(n+1)=(3*3^n-2*2^n)/(n+1) is the second binomial transform of the harmonic sequence 1/(n+1). - Paul Barry, Apr 19 2005
a(n+1) is the sum of n-th row of A036561. - Reinhard Zumkeller, May 14 2006
The sequence gives the sum of the lengths of the segments in Cantor's dust generating sequence up to the i-th step. Measurement unit = length of the segment of i-th step. - Giorgio Balzarotti, Nov 18 2006
Let T be a binary relation on the power set P(A) of a set A having n = |A| elements such that for every element x, y of P(A), xTy if x is a proper subset of y. Then a(n) = |T|. - Ross La Haye, Dec 22 2006
From Alexander Adamchuk, Jan 04 2007: (Start)
a(n) is prime for n in A057468.
p divides a(p) - 1 for prime p.
Quotients (3^p - 2^p - 1)/p, where p = prime(n), are listed in A127071.
Numbers k such that k divides 3^k - 2^k - 1 are listed in A127072.
Pseudoprimes in A127072(n) include all powers of primes {2,3,7} and some composite numbers that are listed in A127073, which includes all Carmichael numbers A002997.
Numbers n such that n^2 divides 3^n - 2^n - 1 are listed in A127074.
5 divides a(2n).
5^2 divides a(2*5n).
5^3 divides a(2*5^2n).
5^4 divides a(2*5^3n).
7^2 divides a(6*7n).
13 divides a(4n).
13^2 divides a(4*13n).
19 divides a(3n).
19^2 divides a(3*19n).
23^2 divides a(11n).
23^3 divides a(11*23n).
23^4 divides a(11*23^2n).
29 divides a(7n).
p divides a((p-1)n) for prime p>3.
p divides a((p-1)/2) for prime p in A097934. Also primes p such that 6 is a square mod p, except {2,3}, A038876(n).
p^(k+1) divides a(p^k*(p-1)/2*n) for prime p in A097934.
p^(k+1) divides a(p^k*(p-1)*n) for prime p>3.
Note the exception that for p = 23, p^(k+2) divides a(p^k*(p-1)/2*n).
There are no more such exceptions for primes p up to 600000. (End)
a(n) divides a(q*(n+1)-1), for all q integer. Leonardo Sarasua, Apr 15 2024
Final digits of terms follow sequence 1,5,9,5. - Enoch Haga, Nov 26 2007
This is also the second column sequence of the Sheffer triangle A143494 (2-restricted Stirling2 numbers). See the e.g.f. given below. - Wolfdieter Lang, Oct 08 2011
Partial sums give A000392. - Jon Perry, Apr 05 2014
For n >= 1, this is also row 2 of A281890: when consecutive positive integers are written as a product of primes in nondecreasing order, "3" occurs in n-th position a(n) times out of every 6^n. - Peter Munn, May 17 2017
a(n) is the number of ternary sequences of length n which include the digit 2. For example, a(2)=5 since the sequences are 02,20,12,21,22. - Enrique Navarrete, Apr 05 2021
a(n-1) is the number of ways we can form disjoint unions of two nonempty subsets of [n] such that the union contains n. For example, for n = 3, a(2) = 5 since the disjoint unions are {1}U{3}, {1}U{2,3}, {2}U{3}, {2}U{1,3}, and {1,2}U{3}. Cf. A000392 if we drop the requirement that the union contains n. - Enrique Navarrete, Aug 24 2021
Configures as a composite Koch Snowflake Fractal (see illustration in links) based on the five-fold division of the Cantor Square/Cantor Dust Fractal of (9^n-4^n)/5 see my illustration in (A016153). - John Elias, Oct 13 2021
Number of pairs (A,B) where B is a subset of {1,2,...,n} and A is a proper subset of B. - Jianing Song, Jun 18 2022
From Manfred Boergens, Mar 29 2023: (Start)
With regard to the comments by Ross La Haye and Jianing Song: Omitting "proper" gives A000244.
Number of pairs (A,B) where B is a nonempty subset of {1,2,...,n} and A is a nonempty subset of B. For nonempty proper subsets see a(n+1) in A028243. (End)
a(n) is the number of n-digit numbers whose smallest decimal digit is 7. - Stefano Spezia, Nov 15 2023
a(n-1) is the number of all possible player-reduced binary games observed by each player in an nx2 game assuming the individual strategies of k < n - 1 players are fixed and the remaining n - k - 1 player will play as one, either maintaining their status quo strategies or jointly adopting an alternative strategy. - Ambrosio Valencia-Romero, Apr 11 2024

References

  • John H. Conway and Richard K. Guy, The Book of Numbers, New York: Springer-Verlag, 1996. See pp. 86-87.
  • 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

a(n) = row sums of A091913, row 2 of A047969, column 1 of A090888 and column 1 of A038719.
Cf. partitions: A241766, A241759.
A diagonal of A262307.

Programs

  • Haskell
    a001047 n = a001047_list !! n
    a001047_list = map fst $ iterate (\(u, v) -> (3 * u + v, 2 * v)) (0, 1)
    -- Reinhard Zumkeller, Jun 09 2013
  • Magma
    [3^n - 2^n: n in [0..30]]; // Vincenzo Librandi, Jul 17 2011
    
  • Maple
    seq(3^n - 2^n, n=0..40); # Giorgio Balzarotti, Nov 18 2006
    A001047:=1/(3*z-1)/(2*z-1); # Simon Plouffe in his 1992 dissertation, dropping the initial zero
  • Mathematica
    Table[ 3^n - 2^n, {n, 0, 25} ]
    LinearRecurrence[{5, -6}, {0, 1}, 25] (* Harvey P. Dale, Aug 18 2011 *)
    Numerator@NestList[(3#+1)/2&,1/2,100] (* Zak Seidov, Oct 03 2011 *)
  • PARI
    {a(n) = 3^n - 2^n};
    
  • Python
    [3**n - 2**n for n in range(25)] # Ross La Haye, Aug 19 2005; corrected by David Radcliffe, Jun 26 2016
    
  • Sage
    [lucas_number1(n, 5, 6) for n in range(26)]  # Zerinvary Lajos, Apr 22 2009
    

Formula

G.f.: x/((1-2*x)*(1-3*x)).
a(n) = 5*a(n-1) - 6*a(n-2).
a(n) = 3*a(n-1) + 2^(n-1). - Jon Perry, Aug 23 2002
Starting 0, 0, 1, 5, 19, ... this is 3^n/3 - 2^n/2 + 0^n/6, the binomial transform of A086218. - Paul Barry, Aug 18 2003
a(n) = A083323(n)-1 = A056182(n)/2 = (A002783(n)-1)/2 = (A003063(n+2)-A003063(n+1))/2. - Ralf Stephan, Jan 12 2004
Binomial transform of A000225. - Ross La Haye, Feb 07 2005
a(n) = Sum_{k=0..n-1} binomial(n, k)*2^k. - Ross La Haye, Aug 20 2005
a(n) = 2^(2n) - A083324(n). - Ross La Haye, Sep 10 2005
a(n) = A112626(n, 1). - Ross La Haye, Jan 11 2006
E.g.f.: exp(3*x) - exp(2*x). - Mohammad K. Azarian, Jan 14 2009
a(n) = A217764(n,1). - Ross La Haye, Mar 27 2013
a(n) = 2*a(n-1) + 3^(n-1). - Toby Gottfried, Mar 28 2013
a(n) = A000244(n) - A000079(n). - Omar E. Pol, Mar 28 2013
a(n) = Sum_{k=0..2} Stirling1(2,k)*(k+1)^n = c_2^{(-n)}, poly-Cauchy numbers. - Takao Komatsu, Mar 28 2013
a(n) = A227048(n,A098294(n)). - Reinhard Zumkeller, Jun 30 2013
a(n+1) = Sum_{k=0..n} 2^k*3^(n-k). - J. M. Bergot, Mar 27 2018
Sum_{n>=1} 1/a(n) = A329064. - Amiram Eldar, Nov 20 2020
a(n) = (1/2)*Sum_{k=0..n} binomial(n, k)*(2^(n-k) + 2^k - 2).
a(n) = A001117(n) + 2*A000918(n) + 1. - Ambrosio Valencia-Romero, Mar 08 2022
a(n) = A000225(n) + A028243(n+1). - Ambrosio Valencia-Romero, Mar 09 2022
From Peter Bala, Jun 27 2025: (Start)
exp(Sum_{n >=1} a(2*n)/a(n)*x^n/n) = Sum_{n >= 0} a(n+1)*x^n.
exp(Sum_{n >=1} a(3*n)/a(n)*x^n/n) = 1 + 19*x + 247*x^2 + ... is the g.f. of A019443.
exp(Sum_{n >=1} a(4*n)/a(n)*x^n/n) = 1 + 65*x + 2743*x^2 + ... is the g.f. of A383754.
The following are all examples of telescoping series:
Sum_{n >= 1} 6^n/(a(n)*a(n+1)) = 2, since 6^n/(a(n)*a(n+1)) = b(n) - b(n+1), where b(n) = 2^n/a(n);
Sum_{n >= 1} 18^n/(a(n)*a(n+1)*a(n+2)) = 22/75, since 18^n/(a(n)*a(n+1)*a(n+2)) = c(n) - c(n+1), where c(n) = (5*6^n - 2*4^n)/(15*a(n)*a(n+1));
Sum_{n >= 1} 54^n/(a(n)*a(n+1)*a(n+2)*a(n+3)) = 634/48735 since 54^n/(a(n)*a(n+1)*a(n+2)*a(n+3)) = d(n) - d(n+1), where d(n) = (57*18^n - 38*12^n + 8*8^n)/(513*a(n)*a(n+1)*a(n+2)).
Sum_{n >= 1} 6^n/(a(n)*a(n+2)) = 14/25; Sum_{n >= 1} (-6)^n/(a(n)*a(n+2)) = -6/25.
Sum_{n >= 1} 6^n/(a(n)*a(n+3)) = 306/1805.
Sum_{n >= 1} 6^n/(a(n)*a(n+4)) = 4282/80275; Sum_{n >= 1} (-6)^n/(a(n)*a(n+4)) = -1698/80275. (End)

Extensions

Edited by Charles R Greathouse IV, Mar 24 2010

A003313 Length of shortest addition chain for n.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

Equivalently, minimal number of multiplications required to compute the n-th power.

Examples

			For n < 149 and for many higher values of n, a(n) is the depth of n in a tree whose first 6 levels are shown below. The path from the root of the tree to n gives an optimal addition chain. (See Knuth, Vol. 2, Sect. 4.6.3, Fig. 14 and Ex. 5.)
                  1
                  |
                  2
                 / \
                /   \
               /     \
              /       \
             /         \
            3           4
           / \           \
          /   \           \
         /     \           \
        /       \           \
       5         6           8
      / \        |         /   \
     /   \       |        /     \
    7    10      12      9       16
   /    /  \    /  \    /  \    /  \
  14   11  20  15  24  13  17  18  32
E.g., a(15) = 5 and an optimal chain for 15 is 1, 2, 3, 6, 12, 15.
It is not possible to extend the tree to include the optimal addition chains for all n. For example, the chains for 43, 77, and 149 are incompatible. See the link to Achim Flammenkamp's web page on addition chains.
		

References

  • Hatem M. Bahig, Mohamed H. El-Zahar, and Ken Nakamula, Some results for some conjectures in addition chains, in Combinatorics, computability and logic, pp. 47-54, Springer Ser. Discrete Math. Theor. Comput. Sci., Springer, London, 2001.
  • D. Bleichenbacher and A. Flammenkamp, An Efficient Algorithm for Computing Shortest Addition Chains, Preprint, 1997.
  • A. Flammenkamp, Drei Beitraege zur diskreten Mathematik: Additionsketten, No-Three-in-Line-Problem, Sociable Numbers, Diplomarbeit, Bielefeld 1991.
  • S. B. Gashkov and V. V. Kochergin, On addition chains of vectors, gate circuits and the complexity of computations of powers [translation of Metody Diskret. Anal. No. 52 (1992), 22-40, 119-120; 1265027], Siberian Adv. Math. 4 (1994), 1-16.
  • A. A. Gioia and M. V. Subbarao, The Scholz-Brauer problem in addition chains, II, in Proceedings of the Eighth Manitoba Conference on Numerical Mathematics and Computing (Univ. Manitoba, Winnipeg, Man., 1978), pp. 251-274, Congress. Numer., XXII, Utilitas Math., Winnipeg, Man., 1979.
  • D. E. Knuth, The Art of Computer Programming, vol. 2, Seminumerical Algorithms, 2nd ed., Fig. 14 on page 403; 3rd edition, 1998, p. 465.
  • D. E. Knuth, website, further updates to Vol. 2 of TAOCP.
  • Michael O. Rabin and Shmuel Winograd, "Fast evaluation of polynomials by rational preparation." Communications on Pure and Applied Mathematics 25.4 (1972): 433-458. See Table p. 455.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Formula

a(n*m) <= a(n)+a(m). In particular, a(n^k) <= k * a(n). - Max Alekseyev, Jul 22 2005
For all n >= 2, a(n) <= (4/3)*floor(log_2 n) + 2. - Jonathan Vos Post, Oct 08 2008
From Achim Flammenkamp, Oct 26 2016: (Start)
a(n) <= 9/log_2(71) log_2(n), for all n.
It is conjectured by D. E. Knuth, K. Stolarsky et al. that for all n: floor(log_2(n)) + ceiling(log_2(v(n))) <= a(n). (End)
a(n) <= A014701(n). - Charles R Greathouse IV, Jan 03 2018
From Szymon Lukaszyk, Apr 05 2024: (Start)
For n = 2^s, a(n)=s;
for n = 2^s + 2^m, m in [0..s-1] (A048645), a(n)=s+1;
for n = 2^s + 3*2^m, m in [0..s-2] (A072823), a(n)=s+2;
for n = 2^s + 7*2^(s-3), s>2 (A072823), a(n)=s+2.(End)

Extensions

More terms from Jud McCranie, Nov 01 2001

A001855 Sorting numbers: maximal number of comparisons for sorting n elements by binary insertion.

Original entry on oeis.org

0, 1, 3, 5, 8, 11, 14, 17, 21, 25, 29, 33, 37, 41, 45, 49, 54, 59, 64, 69, 74, 79, 84, 89, 94, 99, 104, 109, 114, 119, 124, 129, 135, 141, 147, 153, 159, 165, 171, 177, 183, 189, 195, 201, 207, 213, 219, 225, 231, 237, 243, 249, 255, 261, 267, 273, 279, 285
Offset: 1

Views

Author

Keywords

Comments

Equals n-1 times the expected number of probes for a successful binary search in a size n-1 list.
Piecewise linear: breakpoints at powers of 2 with values given by A000337.
a(n) is the number of digits in the binary representation of all the numbers 1 to n-1. - Hieronymus Fischer, Dec 05 2006
It is also coincidentally the maximum number of comparisons for merge sort. - Li-yao Xia, Nov 18 2015

References

  • D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, Vol. 3, Sect 5.3.1, Eq. (3); Sect. 6.2.1 (4).
  • J. W. Moon, Topics on Tournaments. Holt, NY, 1968, p. 48.
  • 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).
  • Tianxing Tao, On optimal arrangement of 12 points, pp. 229-234 in Combinatorics, Computing and Complexity, ed. D. Du and G. Hu, Kluwer, 1989.

Crossrefs

Programs

  • Haskell
    import Data.List (transpose)
    a001855 n = a001855_list !! n
    a001855_list = 0 : zipWith (+) [1..] (zipWith (+) hs $ tail hs) where
       hs = concat $ transpose [a001855_list, a001855_list]
    -- Reinhard Zumkeller, Jun 03 2013
    
  • Maple
    a := proc(n) local k; k := ilog2(n) + 1; 1 + n*k - 2^k end; # N. J. A. Sloane, Dec 01 2007 [edited by Peter Luschny, Nov 30 2017]
  • Mathematica
    a[n_?EvenQ] := a[n] = n + 2a[n/2] - 1; a[n_?OddQ] := a[n] = n + a[(n+1)/2] + a[(n-1)/2] - 1; a[1] = 0; a[2] = 1; Table[a[n], {n, 1, 58}] (* Jean-François Alcover, Nov 23 2011, after Pari *)
    a[n_] := n IntegerLength[n, 2] - 2^IntegerLength[n, 2] + 1;
    Table[a[n], {n, 1, 58}] (* Peter Luschny, Dec 02 2017 *)
    Accumulate[BitLength[Range[0, 100]]] (* Paolo Xausa, Sep 30 2024 *)
  • PARI
    a(n)=if(n<2,0,n-1+a(n\2)+a((n+1)\2))
    
  • PARI
    a(n)=local(m);if(n<2,0,m=length(binary(n-1));n*m-2^m+1)
    
  • Python
    def A001855(n):
        s, i, z = 0, n-1, 1
        while 0 <= i: s += i; i -= z; z += z
        return s
    print([A001855(n) for n in range(1, 59)]) # Peter Luschny, Nov 30 2017
    
  • Python
    def A001855(n): return n*(m:=(n-1).bit_length())-(1<Chai Wah Wu, Mar 29 2023

Formula

Let n = 2^(k-1) + g, 0 <= g <= 2^(k-1); then a(n) = 1 + n*k - 2^k. - N. J. A. Sloane, Dec 01 2007
a(n) = Sum_{k=1..n}ceiling(log_2 k) = n*ceiling(log_2 n) - 2^ceiling(log_2(n)) + 1.
a(n) = a(floor(n/2)) + a(ceiling(n/2)) + n - 1.
G.f.: x/(1-x)^2 * Sum_{k>=0} x^2^k. - Ralf Stephan, Apr 13 2002
a(1)=0, for n>1, a(n) = ceiling(n*a(n-1)/(n-1)+1). - Benoit Cloitre, Apr 26 2003
a(n) = n-1 + min { a(k)+a(n-k) : 1 <= k <= n-1 }, cf. A003314. - Vladeta Jovovic, Aug 15 2004
a(n) = A061168(n-1) + n - 1 for n>1. - Hieronymus Fischer, Dec 05 2006
a(n) = A123753(n-1) - n. - Peter Luschny, Nov 30 2017

Extensions

Additional comments from M. D. McIlroy (mcilroy(AT)dartmouth.edu)

A003064 a(n) = smallest number with shortest addition chain of length n.

Original entry on oeis.org

1, 2, 3, 5, 7, 11, 19, 29, 47, 71, 127, 191, 379, 607, 1087, 1903, 3583, 6271, 11231, 18287, 34303, 65131, 110591, 196591, 357887, 685951, 1176431, 2211837, 4169527, 7624319, 14143037, 25450463, 46444543, 89209343, 155691199, 298695487, 550040063, 994660991
Offset: 0

Views

Author

Keywords

Comments

An addition chain of length n for a number a is a sequence 1 = a_0, a_1,..., a_n = a such that for each i>0, a_i is the sum of two (not necessarily distinct) elements of the sequence. - Glen Whitney, Nov 09 2021
The largest number with an addition chain of length n is 2^n. This chain is of course shortest for 2^n. - Franklin T. Adams-Watters, Jan 20 2016
The step from a_{i-1} to a_i is called "small" if a_i is less than the smallest power of two greater than a_{i-1}. The sequence b(n) of the smallest number which requires n small steps in an addition chain is a subsequence of this sequence, starting a(0), a(2), a(4), a(7), a(10), a(15), a(21), a(28), a(37), a(46),... - Glen Whitney, Nov 09 2021

Examples

			a(7) = 29 because 29 is the smallest number with a shortest addition chain requiring 7 additions. An example of a shortest addition chain for 29 is (1 2 3 4 7 11 18 29).
		

References

  • D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, Vol. 2, p. 458; Vol. 2, 3rd. ed., p. 477.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • See A003313 for a much more extensive list of references and links.

Crossrefs

This is the "smallest inverse" of A003313. Cf. A003065.
Cf. A075530, A115617 [Smallest number for which Knuth's power tree method produces an addition chain of length n].

Extensions

New terms from Achim Flammenkamp, Math. Diplomarbeit, Univ. Bielefeld, 1991; and from Daniel Bleichenbacher (bleichen(AT)inf.ethz.ch)
a(25)-a(27) from the 3rd. ed. of Knuth vol. 2, sent by David Moulton, Jun 24 2003
a(28)-a(30) from Achim Flammenkamp's web site, Feb 01 2005
a(31) computed Dec 15 2005 by Neill M. Clift. - Hugo Pfoertner, Jan 29 2006
a(32) from Neill M. Clift, Jun 15 2007
a(33)-a(34) from Neill M. Clift, May 21 2008
b-file up to a(41) extracted from Achim Flammenkamp's web site. - R. J. Mathar, May 14 2013
b-file updated to a(46) from Achim Flammenkamp's web site. - Glen Whitney, Nov 09 2021

A003314 Binary entropy function: a(1)=0; for n > 1, a(n) = n + min { a(k)+a(n-k) : 1 <= k <= n-1 }.

Original entry on oeis.org

0, 2, 5, 8, 12, 16, 20, 24, 29, 34, 39, 44, 49, 54, 59, 64, 70, 76, 82, 88, 94, 100, 106, 112, 118, 124, 130, 136, 142, 148, 154, 160, 167, 174, 181, 188, 195, 202, 209, 216, 223, 230, 237, 244, 251, 258, 265, 272, 279, 286, 293, 300, 307, 314, 321, 328, 335
Offset: 1

Views

Author

Keywords

Comments

Morris gives many other interesting properties of this function.
a(n) is a convex function of n. (See the Morris reference.)

Examples

			a(6) = 6 + min {1+12, 2+8, 5+5} = 6 + 10 = 16.
		

References

  • D. E. Knuth, The Art of Computer Programming. Addison-Wesley, Reading, MA, Vol. 3, Sect 5.4.9, Eq. (19). p. 374.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    a003314 n = a003314_list !! (n-1)
    a003314_list = 0 : f [0] [2..] where
       f vs (w:ws) = y : f (y:vs) ws where
         y = w + minimum (zipWith (+) vs $ reverse vs)
    -- Reinhard Zumkeller, Aug 13 2013
    
  • Maple
    A003314 := proc(n) local i,j; option remember; if n<=2 then n elif n=3 then 5 else j := 10^10; for i from 1 to n-1 do if A003314(i)+A003314(n-i) < j then j := A003314(i)+A003314(n-i); fi; od; n+j; fi; end;
  • Mathematica
    a[1] = 0; a[n_] := If[OddQ[n], n + a[(n-1)/2 + 1] + a[(n-1)/2], 2*(n/2 + a[n/2])];
    Table[a[n], {n, 1, 57}] (* Jean-François Alcover, Oct 15 2012 *)
    a[n_] := n + n IntegerLength[n, 2] - 2^IntegerLength[n, 2];
    Table[a[n], {n, 1, 57}] (* Peter Luschny, Dec 02 2017 *)
  • PARI
    a(n)=if(n<2,0,n+a(n\2)+a((n+1)\2))
    
  • PARI
    a(n)=local(m);if(n<2,0,m=length(binary(n-1));n*m-2^m+n)
    
  • Python
    def A003314(n):
        return n*int(math.log(4*n,2))-2**int(math.log(2*n,2)) # Indranil Ghosh, Feb 03 2017
    
  • Python
    def A003314(n):
        s, i, z = n-1, n-1, 1
        while 0 <= i: s += i; i -= z; z += z
        return s
    print([A003314(n) for n in range(1, 58)]) # Peter Luschny, Nov 30 2017
    
  • Python
    def A003314(n): return n*(1+(m:=(n-1).bit_length()))-(1<Chai Wah Wu, Mar 29 2023

Formula

a(1) = 0; a(n) = n + a([n/2]) + a(n-[n/2]). (See the Morris reference.)
a(n) = A001855(n)+n-1. - Michael Somos Feb 07 2004
a(n) = n + a(floor(n/2)) + a(ceiling(n/2)) = n*floor(log_2(4n))-2^floor(log_2(2n)) = A033156(n) - n = n*A070941(n) - A062383(n). - Henry Bottomley, Jul 03 2002
a(1) = 0 and for n>1: a(n) = a(n-1) + A070941(2*n-1). Also a(n) = A123753(n-1) - 1. - Reinhard Zumkeller, Oct 12 2006
a(n) = A123753(n-1) - 1. - Peter Luschny, Nov 30 2017

A090888 Matrix defined by a(n,k) = 3^n*Fibonacci(k) - 2^n*Fibonacci(k-2), read by antidiagonals.

Original entry on oeis.org

1, 2, 0, 4, 1, 1, 8, 5, 3, 1, 16, 19, 9, 4, 2, 32, 65, 27, 14, 7, 3, 64, 211, 81, 46, 23, 11, 5, 128, 665, 243, 146, 73, 37, 18, 8, 256, 2059, 729, 454, 227, 119, 60, 29, 13, 512, 6305, 2187, 1394, 697, 373, 192, 97, 47, 21, 1024, 19171, 6561, 4246, 2123, 1151, 600, 311
Offset: 0

Views

Author

Ross La Haye, Feb 12 2004; revised Sep 24 2004, Sep 10 2005

Keywords

Comments

a(0,k) = A000045(k-1); a(1,k) = A000032(k); a(2,k) = A000285(k+1).
a(n,1) = a(n-1,1) + a(n-1,3) for n > 0; a(n,1) = A001047(n) = 2^(2n) - A083324(n); a(n,2) = A000244(n) = 2^(2n) - A005061(n); a(n,3) = 2a(n-1,4) for n > 0; a(n,3) = A027649(n); a(n,4) = A083313(n+1); a(n,5) = A084171(n+1).
Sum[a(n-k,k), {k,0,n}] = A098703(n+1), antidiagonal sums.
Let R, S and T be binary relations on the power set P(A) of a set A having n = |A| elements such that for every element x, y of P(A), xRy if x is a subset of y or y is a subset of x, xSy if x is a subset of y and xTy if x is a proper subset of y. Then a(n,3) = |R|, a(n,2) = |S| and a(n,1) = |T|. Note that a binary relation W on P(A) can be defined also such that for every element x, y of P(A) xWy if x is a proper subset of y and there are no z in P(A) such that x is a proper subset of z and z is a proper subset of y. A090802(n,1) = |W|. Also, a(n,0) = |P(A)|.

Examples

			   1    0    1    1    2    3    5    8    13    21    34
   2    1    3    4    7   11   18   29    47    76   123
   4    5    9   14   23   37   60   97   157   254   411
   8   19   27   46   73  119  192  311   503   814  1317
  16   65   81  146  227  373  600  973  1573  2546  4119
  32  211  243  454  697 1151 1848 2999  4847  7846 12693
  64  665  729 1394 2123 3517 5640 9157 14797 23954 38751
a(5,3) = 454 because Fibonacci(3) = 2, Fibonacci(1) = 1 and (2 * 3^5) - (1 * 2^5) = 454.
		

Programs

  • Mathematica
    Table[3^(n - k) Fibonacci@ k - 2^(n - k) Fibonacci[k - 2], {n, 0, 10}, {k, 0, n}] // Flatten (* Michael De Vlieger, Nov 28 2015 *)

Formula

a(n, k) = 3^n*Fibonacci(k) - 2^n*Fibonacci(k-2).
a(n, 0) = 2^n, a(n, 1) = 3^n - 2^n, a(n, k) = a(n, k-1) + a(n, k-2) for k > 1.
a(0, k) = Fibonacci(k-1), a(1, k) = Lucas(k), a(n, k) = 5a(n-1, k) - 6a(n-2, k) for n > 1.
O.g.f. (by rows) = (-2^n + (2^(n+1) - 3^n)x)/(-1+x+x^2). - Ross La Haye, Mar 30 2006
a(n,1) - a(n,0) = A003063(n+1). - Ross La Haye, Jun 22 2007
Binomial transform (by columns) of A118654. - Ross La Haye, Jun 22 2007

Extensions

More terms from Ray Chandler, Oct 27 2004

A083313 a(0)=1; a(n) = 3^n - 2^(n-1) for n >= 1.

Original entry on oeis.org

1, 2, 7, 23, 73, 227, 697, 2123, 6433, 19427, 58537, 176123, 529393, 1590227, 4774777, 14332523, 43013953, 129074627, 387289417, 1161999323, 3486260113, 10459304627, 31378962457, 94138984523, 282421147873, 847271832227, 2541832273897, 7625530376123
Offset: 0

Views

Author

Paul Barry, Apr 24 2003

Keywords

Comments

Essentially the same as A064686.
Binomial transform of A051049.
Number of skinny Boolean functions f(x_1,...,x_n) that are also Horn functions. - Hugo Pfoertner, Mar 04 2019

References

  • Donald E. Knuth, The Art of Computer Programming, Vol. 4, fascicle 1, section 7.1.4, pp. 134, 138, 139, 219, answer to exercise 172, Addison-Wesley, 2009.

Crossrefs

Cf. A083314.

Programs

  • Magma
    [(2*3^n-2^n+0^n)/2: n in [0..30]]; // Vincenzo Librandi, Feb 01 2015
  • Maple
    A083313 := proc(n)
        if n = 0 then
            1;
        else
            3^n-2^(n-1) ;
        end if;
    end proc: # R. J. Mathar, Aug 01 2013
  • Mathematica
    CoefficientList[Series[((1 - x) + (1 - 2 x) (1 - 3 x)) / (2 (1 - 2 x) (1 - 3 x)), {x, 0, 30}], x] (* Vincenzo Librandi, Feb 01 2015 *)
    LinearRecurrence[{5,-6},{1,2,7},30] (* Harvey P. Dale, Sep 04 2017 *)
  • PARI
    Vec(((1-x)+(1-2*x)*(1-3*x))/(2*(1-2*x)*(1-3*x)) + O(x^30)) \\ Michel Marcus, Jan 31 2015
    
  • PARI
    print1(1,", ",s=2,", " );for(k=2,27,s=2^(k-2)+3*s;print1(s,", ")) \\ Hugo Pfoertner, Mar 04 2019
    

Formula

a(n) = (2*3^n - (2^n - 0^n))/2.
a(0) = 1, a(n) = 3^n - 2^(n-1) for n >= 1.
G.f.: ((1-x) + (1-2*x)*(1-3*x))/(2*(1-2*x)*(1-3*x)).
E.g.f.: (2*exp(3*x) - exp(2*x) + exp(0))/2.
a(n) = A090888(n-1, 4), for n > 0. - Ross La Haye, Sep 21 2004
Let b(n) = 2*(3/2)^n - 1. Then A003063(n) = -b(1-n)*3^(n-1) for n > 0. a(n) = A064686(n) = b(n)*2^(n-1) for n > 0. - Michael Somos, Aug 06 2006
From Alex Ratushnyak, Jul 03 2012: (Start)
a(n) mod 100 = 23 for n = 4*k-1, k >= 1.
a(n) mod 100 = 27 for n = 4*k+1, k >= 1.
(End)

Extensions

Better name by Alex Ratushnyak, Jul 02 2012

A252750 a(n) = A003961(A005940(n+1)) - 2 * A005940(n+1).

Original entry on oeis.org

-1, -1, -1, 1, -3, 3, 7, 11, -3, 1, 5, 21, -1, 39, 71, 49, -9, 5, 13, 23, 7, 45, 85, 87, 23, 47, 95, 153, 93, 267, 463, 179, -9, -5, -1, 43, -19, 81, 149, 109, -11, 91, 175, 195, 189, 345, 605, 309, -73, 167, 311, 241, 357, 435, 775, 531, 645, 529, 965, 909, 1151, 1551, 2639, 601, -15, -1, 7, 29, -11, 63, 127, 185, 5, 53, 125, 327, 87, 573, 997, 407, -65, 121, 253, 413, 231
Offset: 0

Views

Author

Antti Karttunen, Dec 21 2014

Keywords

Comments

From Antti Karttunen, May 21 2024: (Start)
Like A005940 itself, also this irregular table derived from it can be represented as a binary tree:
-1
|
................. -1 ..................
-1 1
-3 ......./ \....... 3 7 ......./ \....... 11
/ \ / \ / \ / \
/ \ / \ / \ / \
/ \ / \ / \ / \
-3 1 5 21 -1 39 71 49
-9 5 13 23 7 45 85 87 23 47 95 153 93 267 463 179
etc.
(End)

Crossrefs

Cf. A252743 (characteristic function for positive terms), A252751 (partial sums of sequence b(0) = 0, b(n) = a(n), for n>0).
Cf. A062234 (when negated forms the left edge apart from the initial term), A003063 (right edge).
Cf. also A372562 (apart from the initial term, same data in square array).

Programs

Formula

a(n) = A003961(A005940(n+1)) - 2 * A005940(n+1).
a(n) = A252748(A005940(n+1)).
Other identities. For all n >= 1:
sgn(a(n)) = (-1)^(1+A252743(n)).

Extensions

Term a(0) = -1 prepended by Antti Karttunen, May 21 2024

A214091 a(n) = 3^n - 2^(n+2).

Original entry on oeis.org

-3, -5, -7, -5, 17, 115, 473, 1675, 5537, 17635, 54953, 168955, 515057, 1561555, 4717433, 14217835, 42784577, 128615875, 386371913, 1160164315, 3482590097, 10451964595, 31364282393, 94109624395, 282362427617, 847154391715, 2541597392873, 7625060614075, 22875718713137
Offset: 0

Views

Author

Alex Ratushnyak, Jul 03 2012

Keywords

Comments

The subsequence of (positive or negative) primes begins: -3, -5, -7, -5, 17, no more through the composite a(116) (which is near 2.2*10^55). - Jonathan Vos Post, Jul 03 2012

Crossrefs

Cf. A001047 (3^n - 2^n), A003063 (3^n - 2^(n+1)).

Programs

  • Magma
    [3^n - 2^(n+2): n in [0..30]]; // Vincenzo Librandi, Jun 18 2014
  • Mathematica
    Table[3^n - 2^(n+2), {n, 0, 30}] (* or *) CoefficientList[Series[(-3 + 10 x)/((3 x - 1) (2 x - 1)), {x, 0, 30}], x] (* Vincenzo Librandi, Jun 17 2014 *)

Formula

G.f.: ( -3+10*x ) / ( (3*x-1)*(2*x-1) ). - R. J. Mathar, Jul 07 2012
a(n) = 5*a(n-1) - 6*a(n-2) for n>1. - Vincenzo Librandi, Jun 18 2014
Showing 1-10 of 16 results. Next