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

A136252 a(n) = a(n-1) + 2*a(n-2) - 2*a(n-3).

Original entry on oeis.org

1, 3, 5, 9, 13, 21, 29, 45, 61, 93, 125, 189, 253, 381, 509, 765, 1021, 1533, 2045, 3069, 4093, 6141, 8189, 12285, 16381, 24573, 32765, 49149, 65533, 98301, 131069, 196605, 262141, 393213, 524285, 786429, 1048573, 1572861, 2097149, 3145725, 4194301, 6291453, 8388605
Offset: 0

Views

Author

Paul Curtz, Mar 17 2008

Keywords

Comments

For n >= 2, number of n X n arrays with values that are squares of integers, having all 2 X 2 subblocks summing to 4. - R. H. Hardin, Apr 03 2009
Number of moves required in 4-peg Tower of Hanoi solution using a (suboptimal) recursive algorithm: Move (n-2) disks, move bottom 2 disks, move (n-2) disks. Cf. A007664. - Toby Gottfried, Nov 29 2010

Crossrefs

Same recurrence as in A135530.
Partial sums of A163403.
A060482 without the term 2.
Cf. A007664 (Optimal 4-peg Tower of Hanoi).
The following sequences are all essentially the same, in the sense that they are simple transformations of each other, with A029744 = {s(n), n>=1}, the numbers 2^k and 3*2^k, as the parent: A029744 (s(n)); A052955 (s(n)-1), A027383 (s(n)-2), A354788 (s(n)-3), A347789 (s(n)-4), A209721 (s(n)+1), A209722 (s(n)+2), A343177 (s(n)+3), A209723 (s(n)+4); A060482, A136252 (minor differences from A354788 at the start); A354785 (3*s(n)), A354789 (3*s(n)-7). The first differences of A029744 are 1,1,1,2,2,4,4,8,8,... which essentially matches eight sequences: A016116, A060546, A117575, A131572, A152166, A158780, A163403, A320770. The bisections of A029744 are A000079 and A007283. - N. J. A. Sloane, Jul 14 2022

Programs

  • Maple
    a:=proc(n) options operator,arrow: 2^((1/2)*n-1)*(4+4*(-1)^n+3*sqrt(2)*(1-(-1)^n))-3 end proc: seq(a(n),n=0..40); # Emeric Deutsch, Mar 31 2008
  • Mathematica
    LinearRecurrence[{1, 2, -2}, {1, 3, 5}, 100] (* G. C. Greubel, Feb 18 2017 *)
  • PARI
    x='x+O('x^50); Vec((1+2*x)/((1-x)*(1-2*x^2))) \\ G. C. Greubel, Feb 18 2017

Formula

a(n) = 2^((1/2)*n-1)*(4 + 4(-1)^n + 3*sqrt(2)*(1-(-1)^n)) - 3. - Emeric Deutsch, Mar 31 2008
G.f.: (1+2*x)/((1-x)*(1-2*x^2)). - Jaume Oliver Lafont, Aug 30 2009
a(n) = 2*a(n-2) + 3; first differences are powers of 2, occurring in pairs. - Toby Gottfried, Nov 29 2010
a(n) = A027383(n+1) - 1. - Jason Kimberley, Nov 01 2011
a(2n+1) = (a(2n) + a(2n+2))/2. - Richard R. Forberg, Nov 30 2013
E.g.f.: 4*cosh(sqrt(2)*x) + 3*sqrt(2)*sinh(sqrt(2)*x) - 3*cosh(x) - 3*sinh(x). - Stefano Spezia, May 13 2023

Extensions

Edited by N. J. A. Sloane, Apr 18 2008
More terms from Emeric Deutsch, Mar 31 2008

A137688 2^A003056: 2^n appears n+1 times.

Original entry on oeis.org

1, 2, 2, 4, 4, 4, 8, 8, 8, 8, 16, 16, 16, 16, 16, 32, 32, 32, 32, 32, 32, 64, 64, 64, 64, 64, 64, 64, 128, 128, 128, 128, 128, 128, 128, 128, 256, 256, 256, 256, 256, 256, 256, 256, 256, 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, 1024, 1024, 1024, 1024, 1024, 1024
Offset: 0

Views

Author

M. F. Hasler, Feb 06 2008

Keywords

Comments

First differences of A007664.
Viewed as a triangle, it is computed like Pascal's triangle, but with 2^n on the triangle edges. - T. D. Noe, Jul 31 2013
From Paul Curtz, Oct 23 2018: (Start)
Oresme numbers O(n) = n/2^n are an autosequence of the first kind. The corresponding sequence of the second kind is 1/2^n. The difference table is
1 1/2 1/4 1/8 ...
-1/2 -1/4 -1/8 -1/16 ...
1/4 1/8 1/16 1/32 ...
-1/8 -1/16 -1/32 -1/64 ...
etc.
The denominators on the antidiagonals are a(n). (End)

Examples

			Triangle T(n,k) begins:
1
2, 2
4, 4, 4
8, 8, 8, 8
16, 16, 16, 16, 16
32, 32, 32, 32, 32, 32
64, 64, 64, 64, 64, 64, 64
- _Philippe Deléham_, Dec 26 2013
		

Crossrefs

Cf. A003056, A007664 (gives partial sums).

Programs

  • GAP
    Flat(List([0..10],n->List([1..n+1],k->2^n))); # Muniru A Asiru, Oct 23 2018
    
  • Haskell
    a137688 n = a137688_list !! n
    a137688_list = concat $ zipWith ($) (map replicate [1..]) (map (2^) [0..])
    -- Reinhard Zumkeller, Mar 18 2011
    
  • Maple
    seq(seq(2^n,k=1..n+1),n=0..10); # Muniru A Asiru, Oct 23 2018
  • Mathematica
    t = {}; Do[r = {}; Do[If[k == 0||k == n, m = 2^n, m = t[[n, k]] + t[[n, k + 1]]]; r = AppendTo[r, m], {k, 0, n}]; AppendTo[t, r], {n, 0, 9}]; t = Flatten[t] (* Vincenzo Librandi, Aug 01 2013 *)
  • PARI
    A137688(n)= 1<
    				
  • Python
    from math import isqrt
    def A137688(n): return 1<<(isqrt((n<<3)+1)-1>>1) # Chai Wah Wu, Feb 10 2023

Formula

a(n) = 2^[sqrt(2n+2)-.5] = 2^A003056(n) = A007664(n+1) - A007664(n).
Closed-form formula for arbitrary left and right borders of Pascal like triangle see A228196. - Boris Putievskiy, Aug 19 2013
Viewed as a triangle T(n,k) : T(n,k)=2*T(n-1,k)+2*T(n-1,k-1)-4*T(n-2,k-1), T(0,0)=1, T(n,k)=0 if k<0 or if k>n. - Philippe Deléham, Dec 26 2013
Sum_{n>=0} 1/a(n) = 4. - Amiram Eldar, Aug 16 2022

A007665 Tower of Hanoi with 5 pegs.

Original entry on oeis.org

1, 3, 5, 7, 11, 15, 19, 23, 27, 31, 39, 47, 55, 63, 71, 79, 87, 95, 103, 111, 127, 143, 159, 175, 191, 207, 223, 239, 255, 271, 287, 303, 319, 335, 351, 383, 415, 447, 479, 511, 543, 575, 607, 639, 671, 703, 735, 767, 799
Offset: 1

Views

Author

Keywords

References

  • A. Brousseau, Tower of Hanoi with more pegs, J. Recreational Math., 8 (1975-1976), 169-176.
  • Cull, Paul; Ecklund, E. F. On the Towers of Hanoi and generalized Towers of Hanoi problems. Proceedings of the thirteenth Southeastern conference on combinatorics, graph theory and computing (Boca Raton, Fla., 1982). Congr. Numer. 35 (1982), 229--238. MR0725883(85a:68059). - N. J. A. Sloane, Apr 08 2012
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • D. Wood, Towers of Brahma and Hanoi revisited, J. Recreational Math., 14 (1981), 17-24.

Crossrefs

Programs

  • Mathematica
    terms = 100;
    A056556 = Table[Table[m, {(m+1)(m+2)/2}], {m, 0, (6 terms)^(1/3) // Ceiling}] // Flatten;
    a[n_] := With[{t = A056556[[n+1]]}, -1+(1+t(t-1)/2+n-t(t+1)(t+2)/6)*2^t];
    Array[a, terms] (* Jean-François Alcover, Feb 28 2019 *)
  • PARI
    m=1;n=1;while(nK. Spage, Oct 23 2009

Formula

a(n) = - 1 + (1 + A056556(n)*(A056556(n) - 1)/2 + n - A056556(n)*(A056556(n) + 1)*(A056556(n) + 2)/6)*2^A056556(n). - Daniele Parisse, Feb 06 2001

A005665 Minimal number of moves for the cyclic variant of the Towers of Hanoi for 3 pegs and n disks, with the final peg one step away.

Original entry on oeis.org

0, 1, 5, 15, 43, 119, 327, 895, 2447, 6687, 18271, 49919, 136383, 372607, 1017983, 2781183, 7598335, 20759039, 56714751, 154947583, 423324671, 1156544511, 3159738367, 8632565759, 23584608255, 64434348031, 176037912575, 480944521215, 1313964867583, 3589818777599, 9807567290367
Offset: 0

Views

Author

Keywords

Comments

Original name was: Tower of Hanoi with 3 pegs and cyclic moves only (clockwise). - Jianing Song, Nov 01 2024
This looks like sequence A(0,1;2,2;3) of the family of sequences [a,b:c,d:k] considered by Gary Detlefs, and treated as A(a,b;c,d;k) in the W. Lang link given below. - Wolfdieter Lang, Oct 18 2010

References

  • R. L. Graham, D. E. Knuth and O. Patashnik, Concrete Mathematics. Addison-Wesley, Reading, MA, 1990, p. 18.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A005666, A007664, A007665, A026150 (first differences).
Cf. A338024, A292764, A338089 (4 pegs).

Programs

  • Haskell
    a005665 n = a005665_list !! (n-1)
    a005665_list = 0 : 1 : 5 : zipWith (-)
                   (map (* 3) $ drop 2 a005665_list) (map (* 2) a005665_list)
    -- Reinhard Zumkeller, May 01 2013
    
  • Magma
    [Floor(((Sqrt(3)+1)^(n+1)+(Sqrt(3)-1)^(n+1)*(-1)^n)*Sqrt(3)/6-1): n in [0..30] ]; // Vincenzo Librandi, Aug 19 2011
    
  • Mathematica
    a[n_] := Simplify[ ((1 + Sqrt[3])^(n+1) - (1 - Sqrt[3])^(n+1))*Sqrt[3]/6 - 1]; Table[a[n], {n, 0, 30}] (* Jean-François Alcover, Dec 14 2011, after Paul Barry *)
    LinearRecurrence[{3,0,-2},{0,1,5},40] (* Harvey P. Dale, Mar 30 2015 *)
  • PARI
    a(n)=([0,1,0; 0,0,1; -2,0,3]^n*[0;1;5])[1,1] \\ Charles R Greathouse IV, Jun 15 2015

Formula

G.f.: x*(1+2*x)/((1-x)*(1-2*x-2*x^2)). - Simon Plouffe in his 1992 dissertation
From Paul Barry, Sep 05 2006: (Start)
a(n) = ((sqrt(3)+1)^(n+1) + (sqrt(3)-1)^(n+1)*(-1)^n)*sqrt(3)/6 - 1. (End)
a(n) = 2*a(n-1) + 2*a(n-2) + 3. - John W. Layman
a(n) = (1/(2*s3))*((1+s3)^(n+1) - (1-s3)^(n+1)) - 1 where s3 = sqrt(3).
a(n) = 3*a(n-1) - 2*a(n-3), a(0)=0, a(1)=1, a(2)=5 (from the given o.g.f.). Observed by Gary Detlefs. See the W. Lang link. - Wolfdieter Lang, Oct 18 2010
a(n) = 2*A005666(n-1) + 1. - Michel Marcus, Nov 02 2012
a(n) = Sum_{k=1..n} A026150(k). - Ivan N. Ianakiev, Nov 22 2019
E.g.f.: (1/3)*exp(x)*(-3 + 3*cosh(sqrt(3)*x) + sqrt(3)*sinh(sqrt(3)*x)). - Stefano Spezia, Nov 22 2019

Extensions

More terms from Vincenzo Librandi, Aug 19 2011
Name clarified by Paul Zimmermann, Feb 21 2018
New name based on the name of A338024, A292764, and A338089 by Jianing Song, Nov 01 2024

A182058 Number of moves needed to solve the Towers of Hanoi puzzle with 6 pegs and n disks.

Original entry on oeis.org

1, 3, 5, 7, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 57, 65, 73, 81, 89
Offset: 1

Views

Author

N. J. A. Sloane, Apr 08 2012

Keywords

Comments

See A007664 for further references etc.

References

  • Paul Cull and E. F. Ecklund, On the Towers of Hanoi and generalized Towers of Hanoi problems. Proceedings of the thirteenth Southeastern conference on combinatorics, graph theory and computing (Boca Raton, Fla., 1982). Congr. Numer. 35 (1982), 229--238. MR0725883(85a:68059).

Crossrefs

Cf. A007664 (4 pegs), A007665 (5 pegs).

A135471 a(n) = Sum{i=1..n} ( i*2^(i-1) ) - ( A002024(n)*(A002024(n)+1)/2 - n ) * 2^(A002024(n)-1).

Original entry on oeis.org

1, 3, 17, 41, 125, 321, 745, 1777, 4089, 9217, 20417, 45009, 98273, 212977, 458753, 982881, 2097025, 4456353, 9437121, 19922913, 41943041, 88080001, 184549057, 385875713, 805306177, 1677721473, 3489660865, 7247757313, 15032384641, 31138512129, 64424508801
Offset: 1

Views

Author

N. J. A. Sloane, Feb 08 2008

Keywords

Comments

At one time this expression was proposed (erroneously) as a formula for A007664.

Crossrefs

Cf. A007664.

Programs

  • Mathematica
    f[n_] := Floor[Sqrt[2*n] + 1/2]; a[n_] := Sum[ i*2^(i - 1), {i, 1, n}] - (f[n]*(f[n] + 1)/2 - n)*2^(f[n] - 1); Table[a[n], {n, 1, 25}] (* G. C. Greubel, Oct 14 2016 *)

A137695 Tower of Hanoi with p pegs: A(p,n) = number of moves needed for n disks, using Frame's or Stewart's algorithm, read by columns of the upper right triangle of rows p >= 3, columns n >= p-2.

Original entry on oeis.org

1, 3, 3, 7, 5, 5, 15, 9, 7, 7, 31, 13, 11, 9, 9, 63, 17, 15, 13, 11, 11, 127, 25, 19, 17, 15, 13, 13, 255, 33, 23, 21, 19, 17, 15, 15, 511, 41, 27, 25, 23, 21, 19, 17, 17, 1023, 49, 31, 29, 27, 25, 23, 21, 19, 19, 2047, 65, 39, 33, 31, 29, 27, 25, 23, 21, 21, 4095, 81, 47, 37, 35
Offset: 1

Views

Author

M. F. Hasler, Feb 09 2008, revised Feb 10 2008

Keywords

Comments

In the cited paper by Klavzar et al. it is proved that Frame's algorithm and Stewart's algorithm, as well as several variations, all yield the same number of moves needed for the n disk, p peg problem, given by the formula for A(p,n).
This sequence lists the elements of the upper right triangle of the matrix having as rows the number of moves required, depending on the number of disks, for a given number of pegs. (The first row refers to 3 pegs, etc.) The lower left triangle of the matrix is uninteresting, since all elements below a given diagonal element are equal to that element, namely 2n-1. (For p>n, each disk can be moved to a separate peg.)
However, the article by Klavžar and Milutinović, "Simple explicit formulas for the Frame-Stewart numbers", points out that there is (at least as of 2002) no proof that this algorithm is optimal. - N. J. A. Sloane, Sep 10 2018

Examples

			The complete matrix would read (starting with row p = 3, column n = 1):
  1_  3   7  15  31   63  127  255  511 1023 ...
  1 \_3_  5   9  13   17   25   33   41   49 ...
  1   3 \_5_  7  11   15   19   23   27   31 ...
  1   3   5 \_7_  9   13   17   21   25   29 ...
  1   3   5   7 \_9_  11   15   19   23   27 ...
  1   3   5   7   9 \_11_  13   17   21   25 ...
  1   3   5   7   9   11 \_13_  15   19   23 ...
  1   3   5   7   9   11   13 \_15_  17   21 ...
  1   3   5   7   9   11   13   15 \_17_  19 ...                     _
(Since the columns become constant below the diagonal (symbolized by  \_), we list only the part above it.)
First row: 3 pegs, equals A000225; 2nd row: 4 pegs, cf. A007664; 3rd row: 5 pegs, cf. A007665.
		

References

  • Sandi Klavžar and Uroš Milutinović. "Simple explicit formulas for the Frame-Stewart numbers." Annals of Combinatorics 6.2 (2002): 157-167; 0218-0006/02/020157-11. [This is an 11-page article. There is a free article on the web with the same authors and title, but which is only two pages long. - N. J. A. Sloane, Sep 10 2018]

Crossrefs

Programs

  • Mathematica
    s[n_, p_] := (k = 0; While[ n > Binomial[p - 3 + k++, p - 2] ] ; k - 2); x[n_, p_] := (snp = s[n, p]; Sum[2^t*Binomial[p - 3 + t, p - 3], {t, 0, snp - 1}] + 2^snp*(n - Binomial[p - 3 + snp, p - 2])); Flatten[Table[x[n, p], {n, 1, 12}, {p, 3, n + 2}] ] (* Jean-François Alcover, Jun 01 2011 *)
  • PARI
    A137695(p, n=0/* if n=0, give p-th term of the "flat" sequence */)={n || p = 2+p+(1-n=1+sqrtint(2*p-2-sqrtint(2*p-2)))*n\2; if(p>n+1, 2*n-1, p==3, 2^n-1, my(s=1, t=0); while( n>binomial(p-2+t++,p-2), s+=2^t*binomial(p-3+t, p-3)); s+2^t*(n-binomial(p-3+t,p-2)))} \\ Edited by M. F. Hasler, Apr 08 2025

Formula

A(p,n) = Sum_{t=0..s-1} 2^t*binomial(p-3+t, p-3) + 2^s*(n-binomial(p-3+s, p-2)) where s = max { k in Z | n > binomial(p-3+k,p-2) }.
A(p,n) = 2n-1 if n > p+1, else 2^n-1 if p = 3, else see above. - M. F. Hasler, Apr 08 2025

A259653 a(0)=0, a(1)=1, a(n) = min{3 a(k) + (3^(n-k)-1)/2, k=0..(n-1)} for n>=2.

Original entry on oeis.org

0, 1, 4, 7, 16, 25, 34, 61, 88, 115, 142, 223, 304, 385, 466, 547, 790, 1033, 1276, 1519, 1762, 2005, 2734, 3463, 4192, 4921, 5650, 6379, 7108, 9295, 11482, 13669, 15856, 18043, 20230, 22417, 24604, 31165, 37726, 44287, 50848, 57409, 63970, 70531, 77092
Offset: 0

Views

Author

Gheorghe Coserea, Jul 02 2015

Keywords

Comments

A generalization of Frame-Stewart recurrence is a(0)=0, a(1)=1, a(n)=min{q*a(k) + (q^(n-k)-1)/(q-1), k=0..(n-1)} where n>=2 and q>1. The sequence of first differences is q^A003056(n). For q=2 we have the sequence A007664. The current sequence is generated for q=3.

Crossrefs

Essentially partial sums of A098355.

Programs

  • Mathematica
    a[n_] := a[n] = Min[ Table[ 3*a[k] + (3^(n-k) - 1)/2, {k, 0, n-1}]]; a[0] = 0; Table[a[n], {n, 0, 60}]

Formula

a(n) = min {3*a(k) + (3^(n-k)-1)/2 ; k < n}.
a(n) = sum(3^A003056(i), i=0..n-1).

A259665 a(0)=0, a(1)=1, a(n) = min{4 a(k) + (4^(n-k)-1)/3, k=0..(n-1)} for n>=2.

Original entry on oeis.org

0, 1, 5, 9, 25, 41, 57, 121, 185, 249, 313, 569, 825, 1081, 1337, 1593, 2617, 3641, 4665, 5689, 6713, 7737, 11833, 15929, 20025, 24121, 28217, 32313, 36409, 52793, 69177, 85561, 101945, 118329, 134713, 151097, 167481, 233017, 298553, 364089, 429625, 495161
Offset: 0

Views

Author

Gheorghe Coserea, Jul 02 2015

Keywords

Comments

A generalization of Frame-Stewart recurrence is a(0)=0, a(1)=1, a(n)=min{q*a(k) + (q^(n-k)-1)/(q-1), k=0..(n-1)} where n>=2 and q>1. The sequence of first differences is q^A003056(n). For q=2 we have the sequence A007664. The current sequence is generated for q=4.

Crossrefs

Programs

  • Mathematica
    a[n_] := a[n] = Min[ Table[ 4*a[k] + (4^(n-k) - 1)/3, {k, 0, n-1}]]; a[0] = 0; Table[a[n], {n, 0, 60}]

Formula

a(n) = min {4*a(k) + (4^(n-k)-1)/3 ; k < n}.
a(n) = sum(4^A003056(i), i=0..n-1).

A259669 a(0)=0, a(1)=1, a(n) = min{5 a(k) + (5^(n-k)-1)/4, k=0..(n-1)} for n>=2.

Original entry on oeis.org

0, 1, 6, 11, 36, 61, 86, 211, 336, 461, 586, 1211, 1836, 2461, 3086, 3711, 6836, 9961, 13086, 16211, 19336, 22461, 38086, 53711, 69336, 84961, 100586, 116211, 131836, 209961, 288086, 366211, 444336, 522461, 600586, 678711, 756836, 1147461, 1538086, 1928711
Offset: 0

Views

Author

Gheorghe Coserea, Jul 02 2015

Keywords

Comments

A generalization of Frame-Stewart recurrence is a(0)=0, a(1)=1, a(n)=min{q*a(k) + (q^(n-k)-1)/(q-1), k=0..(n-1)} where n>=2 and q>1. The sequence of first differences is q^A003056(n). For q=2 we have the sequence A007664. The current sequence is generated for q=5.

Crossrefs

Programs

  • Mathematica
    a[n_] := a[n] = Min[ Table[ 5*a[k] + (5^(n-k) - 1)/4, {k, 0, n-1}]]; a[0] = 0; Table[a[n], {n, 0, 60}]

Formula

a(n) = min {5*a(k) + (5^(n-k)-1)/4 ; k < n}.
a(n) = sum(5^A003056(i), i=0..n-1).
Showing 1-10 of 13 results. Next