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

A007482 a(n) is the number of subsequences of [ 1, ..., 2n ] in which each odd number has an even neighbor.

Original entry on oeis.org

1, 3, 11, 39, 139, 495, 1763, 6279, 22363, 79647, 283667, 1010295, 3598219, 12815247, 45642179, 162557031, 578955451, 2061980415, 7343852147, 26155517271, 93154256107, 331773802863, 1181629920803, 4208437368135
Offset: 0

Views

Author

Keywords

Comments

The even neighbor must differ from the odd number by exactly one.
If we defined this sequence by the recurrence (a(n) = 3*a(n-1) + 2*a(n-2)) that it satisfies, we could prefix it with an initial 0.
a(n) equals term (1,2) in M^n, M = the 3 X 3 matrix [1,1,2; 1,0,1; 2,1,1]. - Gary W. Adamson, Mar 12 2009
a(n) equals term (2,2) in M^n, M = the 3 X 3 matrix [0,1,0; 1,3,1; 0,1,0]. - Paul Barry, Sep 18 2009
From Gary W. Adamson, Aug 06 2010: (Start)
Starting with "1" = INVERT transform of A002605: (1, 2, 6, 16, 44, ...).
Example: a(3) = 39 = (16, 6, 2, 1) dot (1, 1, 3, 11) = (16 + 6 + 6 + 11). (End)
Pisano periods: 1, 1, 4, 1, 24, 4, 48, 2, 12, 24, 30, 4, 12, 48, 24, 4,272, 12, 18, 24, ... . - R. J. Mathar, Aug 10 2012
A007482 is also the number of ways of tiling a 3 X n rectangle with 1 X 1 squares, 2 X 2 squares and 2 X 1 (vertical) dominoes. - R. K. Guy, May 20 2015
With offset 1 (a(0) = 0, a(1) = 1) this is a divisibility sequence. - Michael Somos, Jun 03 2015
Number of elements of size 2^(-n) in a fractal generated by the second-order reversible cellular automaton, rule 150R (see the reference and the link). - Yuriy Sibirmovsky, Oct 04 2016
a(n) is the number of compositions (ordered partitions) of n into parts 1 (of three kinds) and 2 (of two kinds). - Joerg Arndt, Oct 05 2016
a(n) equals the number of words of length n over {0,1,2,3,4} in which 0 and 1 avoid runs of odd lengths. - Milan Janjic, Jan 08 2017
Start with a single cell at coordinates (0, 0), then iteratively subdivide the grid into 2 X 2 cells and remove the cells that have two '1's in their modulo 3 coordinates. a(n) is the number of cells after n iterations. Cell configuration converges to a fractal with approximate dimension 1.833. - Peter Karpov, Apr 20 2017
This is the Lucas sequence U(P=3,Q=-2), and hence for n>=0, a(n+2)/a(n+1) equals the continued fraction 3 + 2/(3 + 2/(3 + 2/(3 + ... + 2/3))) with n 2's. - Greg Dresden, Oct 06 2019

Examples

			G.f. = 1 + 3*x + 11*x^2 + 39*x^3 + 139*x^4 + 495*x^5 + 1763*x^6 + ...
From _M. F. Hasler_, Jun 16 2019: (Start)
For n = 0, (1, ..., 2n) = () is the empty sequence, which is equal to its only subsequence, which satisfies the condition voidly, whence a(0) = 1.
For n = 1, (1, ..., 2n) = (1, 2); among the four subsequences {(), (1), (2), (1,2)} only (1) does not satisfy the condition, whence a(1) = 3.
For n = 2, (1, ..., 2n) = (1, 2, 3, 4); among the sixteen subsequences {(), ..., (1,2,3,4)}, the 5 subsequences (1), (3), (1,3), (2,3,4) and (1,2,3,4) do not satisfy the condition, whence a(2) = 16 - 5 = 11.
(End)
		

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • Stephen Wolfram, A New Kind of Science, Wolfram Media, 2002, p. 439.

Crossrefs

Row sums of triangle A073387.
Cf. A000045, A000129, A001045, A007455, A007481, A007483, A007484, A015518, A201000 (prime subsequence), A052913 (binomial transform), A026597 (inverse binomial transform).
Cf. A206776.

Programs

  • Haskell
    a007482 n = a007482_list !! (n-1)
    a007482_list = 1 : 3 : zipWith (+)
                   (map (* 3) $ tail a007482_list) (map (* 2) a007482_list)
    -- Reinhard Zumkeller, Oct 21 2015
    
  • Magma
    I:=[1,3]; [n le 2 select I[n] else 3*Self(n-1) + 2*Self(n-2): n in [1..30]]; // G. C. Greubel, Jan 16 2018
  • Maple
    a := n -> `if`(n=0, 1, 3^n*hypergeom([(1-n)/2,-n/2], [-n], -8/9)):
    seq(simplify(a(n)), n = 0..23); # Peter Luschny, Jun 28 2017
  • Mathematica
    a[n_]:=(MatrixPower[{{1,4},{1,2}},n].{{1},{1}})[[2,1]]; Table[a[n],{n,0,40}] (* Vladimir Joseph Stephan Orlovsky, Feb 19 2010 *)
    LinearRecurrence[{3,2},{1,3},30] (* Harvey P. Dale, May 25 2013 *)
    a[ n_] := Module[ {m = n + 1, s = 1}, If[ m < 0, {m, s} = -{m, (-2)^m}]; s SeriesCoefficient[ x / (1 - 3 x - 2 x^2), {x, 0, m}]]; (* Michael Somos, Jun 03 2015 *)
    a[ n_] := With[{m = n + 1}, If[ m < 0, (-2)^m a[ -m], Expand[((3 + Sqrt[17])/2)^m - ((3 - Sqrt[17])/2)^m ] / Sqrt[17]]]; (* Michael Somos, Oct 13 2016 *)
  • Maxima
    a(n) := if n=0 then 1 elseif n=1 then 3 else 3*a(n-1)+2*a(n-2);
    makelist(a(n),n,0,12); /* Emanuele Munarini, Jun 28 2017 */
    
  • PARI
    {a(n) = 2*imag(( (3 + quadgen(68)) / 2)^(n+1))}; /* Michael Somos, Jun 03 2015 */
    
  • Sage
    [lucas_number1(n,3,-2) for n in range(1, 25)] # Zerinvary Lajos, Apr 22 2009
    

Formula

G.f.: 1/(1-3*x-2*x^2).
a(n) = 3*a(n-1) + 2*a(n-2).
a(n) = (ap^(n+1)-am^(n+1))/(ap-am), where ap = (3+sqrt(17))/2 and am = (3-sqrt(17))/2.
Let b(0) = 1, b(k) = floor(b(k-1)) + 2/b(k-1); then, for n>0, b(n) = a(n)/a(n-1). - Benoit Cloitre, Sep 09 2002
The Hankel transform of this sequence is [1,2,0,0,0,0,0,0,0,...]. - Philippe Deléham, Nov 21 2007
a(n) = Sum_{k=0..floor(n/2)} binomial(n-k, k)2^k*3^(n-2k). - Paul Barry, Apr 23 2005
a(n) = Sum_{k=0..n} A112906(n,k). - Philippe Deléham, Nov 21 2007
a(n) = - a(-2-n) * (-2)^(n+1) for all n in Z. - Michael Somos, Jun 03 2015
If c = (3 + sqrt(17))/2, then c^n = (A206776(n) + sqrt(17)*a(n-1)) / 2. - Michael Somos, Oct 13 2016
a(n) = 3^n*hypergeom([(1-n)/2,-n/2], [-n], -8/9) for n>=1. - Peter Luschny, Jun 28 2017
a(n) = round(((sqrt(17) + 3)/2)^(n+1)/sqrt(17)). The distance of the argument from the nearest integer is about 1/2^(n+3). - M. F. Hasler, Jun 16 2019
E.g.f.: (1/17)*exp(3*x/2)*(17*cosh(sqrt(17)*x/2) + 3*sqrt(17)*sinh(sqrt(17)*x/2)). - Stefano Spezia, Oct 07 2019
a(n) = (sqrt(2)*i)^n * ChebyshevU(n, -3*i/(2*sqrt(2))). - G. C. Greubel, Dec 24 2021
G.f.: 1/(1 - 3*x - 2*x^2) = Sum_{n >= 0} x^n * Product_{k = 1..n} (k + 2*x + 2)/(1 + k*x) (a telescoping series). Cf. A015518. - Peter Bala, May 08 2024

A078099 Array T(m,n) read by antidiagonals: T(m,n) = number of ways of 3-coloring an m X n grid (m >= 1, n >= 1).

Original entry on oeis.org

1, 2, 2, 4, 6, 4, 8, 18, 18, 8, 16, 54, 82, 54, 16, 32, 162, 374, 374, 162, 32, 64, 486, 1706, 2604, 1706, 486, 64, 128, 1458, 7782, 18150, 18150, 7782, 1458, 128, 256, 4374, 35498, 126534, 193662, 126534, 35498, 4374, 256, 512, 13122, 161926, 882180, 2068146, 2068146, 882180, 161926, 13122, 512
Offset: 1

Views

Author

N. J. A. Sloane, Dec 05 2002

Keywords

Comments

We assume the top left point gets color 1 (or, in other words, take the total number of colorings and divide by 3). The rule for coloring is that horizontally or vertically adjacent points must have different colors. - N. J. A. Sloane, Feb 12 2013
Equals half the number of m X n binary matrices with no 2 X 2 circuit having the pattern 0011 in any orientation. - R. H. Hardin, Oct 06 2010
Also the number of Miura-ori foldings [Ginepro-Hull]. - N. J. A. Sloane, Aug 05 2015

Examples

			Array begins:
1       2       4       8       16      32      64      128     256     512 ...
2       6       18      54      162     486     1458    4374    13122 ...
4       18      82      374     1706    7782    35498   161926 ...
8       54      374     2604    18150   126534  882180 ...
16      162     1706    18150   193662 ...
32      486     7782    126534 ...
For the 1 X n case: the first point gets color 1, thereafter there are 2 choices for each color, so T(1,n) = 2^(n-1).
For the 2 X 2 case, the colorings are
12 12 12 13 13 13
21 23 31 31 32 21
		

References

  • Thomas C. Hull, Coloring Connections with Counting Mountain-Valley Assignments in (book) Origami^6: I. Mathematics, 2015, ed. Koryo Miura, Toshikazu Kawasaki, Tomohiro Tachi, Ryuhei Uehara, Robert J. Lang, Patsy Wang-Iverson, American Mathematical Soc., Dec 18, 2015, 368 pages
  • Michael S. Paterson (Warwick), personal communication.

Crossrefs

Cf. A207997, A020698, A078100. Main diagonal is A068253. Other diagonals produce A078101 and A078102.
Cf. A222444 (4 colorings), A222144 (5 colorings), A222281 (6 colorings), A222340 (7 colorings), A222462 (8 colorings).

Programs

  • Maple
    with(linalg); t := transpose; M[1] := matrix(1,1,[1]); Z[1] := matrix(1,1,0); W[1] := evalm(M[1]+t(M[1])); v[1] := matrix(1,1,1);
    for n from 2 to 6 do t1 := stackmatrix(M[n-1],Z[n-1]); t2 := stackmatrix(t(M[n-1]),M[n-1]); M[n] := t(stackmatrix(t(t1),t(t2))); Z[n] := matrix(2^(n-1),2^(n-1),0); W[n] := evalm(M[n]+t(M[n])); v[n] := matrix(1,2^(n-1),1); od:
    T := proc(m,n) evalm( v[m] &* W[m]^(n-1) &* t(v[m]) ); end;
  • Mathematica
    mmax = 10; M[1] = {{1}}; M[m_] := M[m] = {{M[m-1], Transpose[M[m-1]]}, {Array[0&, {2^(m-2), 2^(m-2)}], M[m-1]}} // ArrayFlatten; W[m_] := M[m] + Transpose[M[m]]; T[m_, 1] := 2^(m-1); T[1, n_] := 2^(n-1); T[m_, n_] := MatrixPower[W[m], n-1] // Flatten // Total; Table[T[m-n+1, n], {m, 1, mmax}, {n, 1, m}] // Flatten (* Jean-François Alcover, Feb 13 2016 *)

Formula

Let M[1] = [1], M[m+1] = the block matrix [ [ M[m], M[m]' ], [ 0, M[m] ] ], W[m] = M[m] + M[m]', then T(m, n) = sum of entries of W[m]^(n-1) (the prime denotes transpose).
T(3,n) = A052913(n). T(4,n) = 2*A078100(n).
T(n,m) = T(m,n). T(1,n)= A000079(n-1). T(2,n)=A025192(n). T(5,n) = 2*A207994(n). T(6,n) = 2*A207995(n). - R. J. Mathar, Nov 23 2015

Extensions

More terms from Alois P. Heinz, Mar 23 2009

A060801 Invert transform of odd numbers: a(n) = Sum_{k=1..n} (2*k+1)*a(n-k), a(0)=1.

Original entry on oeis.org

1, 3, 14, 64, 292, 1332, 6076, 27716, 126428, 576708, 2630684, 12000004, 54738652, 249693252, 1138988956, 5195558276, 23699813468, 108107950788, 493140127004, 2249484733444, 10261143413212, 46806747599172, 213511451169436
Offset: 0

Views

Author

Vladeta Jovovic, Apr 27 2001

Keywords

Comments

a(n) is the number of generalized compositions of n when there are 2*i+1 different types of i, (i=1,2,...). - Milan Janjic, Sep 24 2010

Crossrefs

Cf. A001906, A052530, A033453, A030017, A052913 (partial sums).

Programs

  • Mathematica
    Join[{1}, LinearRecurrence[{5, -2}, {3, 14}, 22]] (* Jean-François Alcover, Aug 07 2018 *)
  • PARI
    Vec((1 - x)^2 / (1 - 5*x + 2*x^2) + O(x^25)) \\ Colin Barker, Mar 19 2019

Formula

G.f.: (x^2-2*x+1)/(2*x^2-5*x+1).
G.f.: 1 / (1 - 3*x - 5*x^2 - 7*x^3 - 9*x^4 - 11*x^5 - ...). - Gary W. Adamson, Jul 27 2009
a(n) = 5*a(n-1) - 2*a(n-2) with a(1) = 3, a(2) = 14, for n >= 3. - Taras Goy, Mar 19 2019
a(n) = (2^(-2-n)*((5-sqrt(17))^n*(-7+sqrt(17)) + (5+sqrt(17))^n*(7+sqrt(17)))) / sqrt(17) for n > 0. - Colin Barker, Mar 19 2019
a(n) = A052913(n)-A052913(n-1). - R. J. Mathar, Sep 20 2020

A079162 a(n) = 5*a(n-2) - 2*a(n-4), with initial terms 0,1,2,4.

Original entry on oeis.org

0, 1, 2, 4, 10, 18, 46, 82, 210, 374, 958, 1706, 4370, 7782, 19934, 35498, 90930, 161926, 414782, 738634, 1892050, 3369318, 8630686, 15369322, 39369330, 70107974, 179585278, 319801226, 819187730, 1458790182, 3736768094, 6654348458, 17045465010, 30354161926, 77753788862
Offset: 0

Views

Author

Robert G. Wilson v, Dec 29 2002

Keywords

Crossrefs

Programs

  • Mathematica
    a[0] = 0; a[1] = 1; a[n_] := a[n] = If[ OddQ[n], a[n - 1] + 2a[n - 2], 2a[n - 1] + a[n - 2]]; Table[a[n], {n, 0, 30}]
    LinearRecurrence[{0,5,0,-2},{0,1,2,4},40] (* Harvey P. Dale, Jul 05 2022 *)

Formula

Also a(n) = a(n-1) + 2a(n-2) if n is odd, else a(n) = 2a(n-1) + a(n-2).
a(2n) = 2*A005824(2n), a(2n+1) = A052913(n) = A005824(2n) + A005824(2n+1).
G.f.: x*(1+2*x-x^2)/(1-5*x^2+2*x^4).

Extensions

Corrected the g.f. and index in formula with A052913 R. J. Mathar, Apr 01 2009, May 02 2009
a(31) onwards from Andrew Howroyd, Mar 19 2025

A295515 The Euclid tree, read across levels.

Original entry on oeis.org

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

Views

Author

Peter Luschny, Nov 25 2017

Keywords

Comments

Set N(x) = 1 + floor(x) - frac(x) and let '"' denote the ditto operator, referring to the previously computed expression. Assume the first expression is '0'. Then [0, repeat(N("))] will generate the natural numbers 0, 1, 2, 3, ... and [0, repeat(1/N("))] will generate the rational numbers 0/1, 1/1, 1/2, 2/1, 1/3, 3/2, ... Every reduced nonnegative rational number r appears exactly once in this list as a relatively prime pair [n, d] = r = n/d. We list numerator and denominator one after the other in the sequence.
The apt name 'Euclid tree' is taken from the exposition of Malter, Schleicher and Don Zagier. It is sometimes called the Calkin-Wilf tree. The enumeration is based on Stern's diatomic series (which is a subsequence) and computed by a modification of Dijkstra's 'fusc' function.
The tree listed has root 0, the variant with root 1 is more widely used. Seen as sequences the difference between the two trees is trivial: it is enough to leave out the first two terms; but as trees they are markedly different (see the example section).

Examples

			The tree with root 0 starts:
                                      [0/1]
                  [1/1,                                    1/2]
        [2/1,                1/3,                3/2,                2/3]
   [3/1,      1/4,      4/3,      3/5,      5/2,      2/5,      5/3,      3/4]
[4/1, 1/5, 5/4, 4/7, 7/3, 3/8, 8/5, 5/7, 7/2, 2/7, 7/5, 5/8, 8/3, 3/7, 7/4, 4/5]
.
The tree with root 1 starts:
                                      [1/1]
                  [1/2,                                    2/1]
        [1/3,                3/2,                2/3,                3/1]
   [1/4,      4/3,      3/5,      5/2,      2/5,      5/3,      3/4,      4/1]
[1/5, 5/4, 4/7, 7/3, 3/8, 8/5, 5/7, 7/2, 2/7, 7/5, 5/8, 8/3, 3/7, 7/4, 4/5, 5/1]
		

References

  • M. Aigner and G. M. Ziegler, Proofs from The Book, Springer-Verlag, Berlin, 3rd ed., 2004.

Crossrefs

Cf. A002487, A174981, A294446 (Stern-Brocot tree), A294442 (Kepler's tree), A295511 (Schinzel-Sierpiński tree), A295512 (encoded by semiprimes).

Programs

  • Maple
    # First implementation: use it only if you are not afraid of infinite loops.
    a := x -> 1/(1+floor(x)-frac(x)): 0; do a(%) od;
    # Second implementation:
    lusc := proc(m) local a, b, n; a := 0; b := 1; n := m; while n > 0 do
    if n mod 2 = 1 then b := a + b else a := a + b fi; n := iquo(n, 2) od; a end:
    R := n -> 3*2^(n-1)-1 .. 2^n: # The range of level n.
    EuclidTree_rat := n -> [seq(lusc(k+1)/lusc(k), k=R(n), -1)]:
    EuclidTree_num := n -> [seq(lusc(k+1), k=R(n), -1)]:
    EuclidTree_den := n -> [seq(lusc(k), k=R(n), -1)]:
    EuclidTree_pair := n -> ListTools:-Flatten([seq([lusc(k+1), lusc(k)], k=R(n), -1)]):
    seq(print(EuclidTree_pair(n)), n=1..5);
  • Sage
    def A295515(n):
        if n == 1: return 0
        M = [0, 1]
        for b in (n//2 - 1).bits():
            M[b] = M[0] + M[1]
        return M[1]
    print([A295515(n) for n in (1..85)])

Formula

Some characteristics in comparison to the tree with root 1, seen as a table with T(n,k) for n >= 1 and 1 <= k <= 2^(n-1). Here Tr(n,k), Tp(n,k), Tq(n,k) denotes the fraction r, the numerator of r and the denominator of r in row n and column k respectively.
With root 0: With root 1:
Root Tr(1,1) 0/1 1/1
Tp(n,1) 0,1,2,3,... 1,1,1,1,...
Tp(n,2^(n-1)) 0,1,2,3,... 1,2,3,4,...
Tq(n,1) 1,1,1,1,... 1,2,3,4,...
Tq(n,2^(n-1)) 1,2,3,4,... 1,1,1,1,...
Sum_k Tp(n,k) 0,2,8,26,... A024023 1,3,9,27,... A000244
Sum_k Tq(n,k) 1,3,9,27,... A000244 1,3,9,27,... A000244
Sum_k 2Tr(n,k) 0,3,9,21,... A068156 2,5,11,23,... A083329
Sum_k Tp(n,k)Tq(n,k) 0,3,17,81,... A052913-1 1,4,18,82,... A052913
----
a(n) = A002487(floor(n/2)). - Georg Fischer, Nov 29 2022

A147840 a(n)=10*a(n-1)-8*a(n-2), a(0)=1, a(1)=8 .

Original entry on oeis.org

1, 8, 72, 656, 5984, 54592, 498048, 4543744, 41453056, 378180608, 3450181632, 31476371456, 287162261504, 2619811643392, 23900818341888, 218049690271744, 1989290355982336, 18148506037649408, 165570737528635392
Offset: 0

Views

Author

Philippe Deléham, Nov 14 2008

Keywords

Comments

a(n) = sum_{k=0..n} 2^n*binomial(n,k)*A007482(k) = 2^n*A052913(n). - R. J. Mathar, Oct 15 2012

Programs

  • Mathematica
    LinearRecurrence[{10,-8},{1,8},20] (* Harvey P. Dale, Dec 02 2021 *)

Formula

a(n)=Sum_{k, 0<=k<=n}A147703(n,k)*7^k . G.f.: (1-2x)/(1-10x+8*x^2).
a(n)= ((17+3*sqrt(17))/34)*(5+sqrt(17))^n + ((17-3*sqrt(17))/34)*(5-sqrt(17))^n [From Richard Choulet, Nov 20 2008]
G.f.: (1-2x)/(1-10x+8x^2). - Harvey P. Dale, Dec 02 2021
Showing 1-6 of 6 results.