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

A220062 Number A(n,k) of n length words over k-ary alphabet, where neighboring letters are neighbors in the alphabet; square array A(n,k), n>=0, k>=0, read by antidiagonals.

Original entry on oeis.org

1, 1, 0, 1, 1, 0, 1, 2, 0, 0, 1, 3, 2, 0, 0, 1, 4, 4, 2, 0, 0, 1, 5, 6, 6, 2, 0, 0, 1, 6, 8, 10, 8, 2, 0, 0, 1, 7, 10, 14, 16, 12, 2, 0, 0, 1, 8, 12, 18, 24, 26, 16, 2, 0, 0, 1, 9, 14, 22, 32, 42, 42, 24, 2, 0, 0, 1, 10, 16, 26, 40, 58, 72, 68, 32, 2, 0, 0
Offset: 0

Views

Author

Alois P. Heinz, Dec 03 2012

Keywords

Comments

Equivalently, the number of walks of length n-1 on the path graph P_k. - Andrew Howroyd, Apr 17 2017

Examples

			A(5,3) = 12: there are 12 words of length 5 over 3-ary alphabet {a,b,c}, where neighboring letters are neighbors in the alphabet: ababa, ababc, abcba, abcbc, babab, babcb, bcbab, bcbcb, cbaba, cbabc, cbcba, cbcbc.
Square array A(n,k) begins:
  1,  1,  1,  1,  1,   1,   1,   1, ...
  0,  1,  2,  3,  4,   5,   6,   7, ...
  0,  0,  2,  4,  6,   8,  10,  12, ...
  0,  0,  2,  6, 10,  14,  18,  22, ...
  0,  0,  2,  8, 16,  24,  32,  40, ...
  0,  0,  2, 12, 26,  42,  58,  74, ...
  0,  0,  2, 16, 42,  72, 104, 136, ...
  0,  0,  2, 24, 68, 126, 188, 252, ...
		

Crossrefs

Columns k=0, 2-10 give: A000007, A040000, A029744(n+2) for n>0, A006355(n+3) for n>0, A090993(n+1) for n>0, A090995(n-1) for n>2, A129639, A153340, A153362, A153360.
Rows 0-6 give: A000012, A001477, A005843(k-1) for k>0, A016825(k-2) for k>1, A008590(k-2) for k>2, A113770(k-2) for k>3, A063164(k-2) for k>4.
Main diagonal gives: A102699.

Programs

  • Maple
    b:= proc(n, i, k) option remember; `if`(n=0, 1,
          `if`(i=0, add(b(n-1, j, k), j=1..k),
          `if`(i>1, b(n-1, i-1, k), 0)+
          `if`(i b(n, 0, k):
    seq(seq(A(n, d-n), n=0..d), d=0..14);
  • Mathematica
    b[n_, i_, k_] := b[n, i, k] = If[n == 0, 1, If[i == 0, Sum[b[n-1, j, k], {j, 1, k}], If[i>1, b[n-1, i-1, k], 0] + If[iJean-François Alcover, Jan 19 2015, after Alois P. Heinz *)
  • PARI
    TransferGf(m,u,t,v,z)=vector(m,i,u(i))*matsolve(matid(m)-z*matrix(m,m,i,j,t(i,j)),vectorv(m,i,v(i)));
    ColGf(m,z)=1+z*TransferGf(m, i->1, (i,j)->abs(i-j)==1, j->1, z);
    a(n,k)=Vec(ColGf(k,x) + O(x^(n+1)))[n+1];
    for(n=0, 7, for(k=0, 7, print1( a(n,k), ", ") ); print(); );
    \\ Andrew Howroyd, Apr 17 2017

A153338 Number of zig-zag paths from top to bottom of a 2n-1 by 2n-1 square whose color is not that of the top right corner.

Original entry on oeis.org

0, 2, 18, 116, 650, 3372, 16660, 79592, 371034, 1697660, 7654460, 34106712, 150499908, 658707896, 2863150440, 12371226064, 53178791162, 227561427612, 969890051884, 4119092850680, 17438036501676, 73611934643368, 309935825654168, 1301878616066736
Offset: 1

Views

Author

Joseph Myers, Dec 24 2008

Keywords

Examples

			a(3) = 3*2 ^ (2*3 - 2) - (2*3 - 1) * binomial(2*3 - 2, 3 - 1) = 18. - _Indranil Ghosh_, Feb 19 2017
		

Crossrefs

Programs

  • Magma
    [(n)*2^(2*n-2)-(2*n-1)*Binomial(2*n-2, n-1): n in [1..30]]; // Vincenzo Librandi, Sep 18 2015
    
  • Mathematica
    Table[n 2^(2 n - 2) - (2 n - 1) Binomial[2 n - 2, n - 1], {n, 22}] (* Michael De Vlieger, Sep 17 2015 *)
  • Python
    import math
    def C(n,r):
        f=math.factorial
        return f(n)/f(r)/f(n-r)
    def A153338(n):
        return str(n*2**(2*n-2)-(2*n-1)*C(2*n-2,n-1)) # Indranil Ghosh, Feb 19 2017

Formula

a(n) = n*2^(2*n-2) - (2*n-1)*binomial(2*n-2,n-1).
4^n*(n+1)-C(2*n,n)*(2*n+1) = Sum_{k=1..n} C(2*(n-k),n-k)*C(2*k,k)*k*(H(k)-H(n-k)) for n >= 0; H(n) denote the harmonic numbers. This identity is attributed to Maillard. - Peter Luschny, Sep 17 2015

Extensions

a(23)-a(24) from Vincenzo Librandi, Sep 18 2015

A153334 Number of zig-zag paths from top to bottom of an n X n square whose color is that of the top right corner.

Original entry on oeis.org

1, 1, 4, 8, 24, 52, 136, 296, 720, 1556, 3624, 7768, 17584, 37416, 83024, 175568, 383904, 807604, 1746280, 3657464, 7839216, 16357496, 34812144, 72407728, 153204064, 317777032, 669108496, 1384524656, 2903267040, 5994736336
Offset: 1

Views

Author

Joseph Myers, Dec 24 2008

Keywords

Crossrefs

Programs

  • Mathematica
    Table[If[Mod[n,2]==0, (n+1)*2^(n-2)-2(n-1) Binomial[n-2,(n-2)/2], (n+1)*2^(n-2)-(n-1)  Binomial[n-1,(n-1)/2]],{n,1,30}] (* Indranil Ghosh, Feb 19 2017 *)
  • Python
    import math
    def C(n,r):
        f=math.factorial
        return f(n)/f(r)/f(n-r)
    def A153334(n):
        if n%2==0: return str(int((n+1)*2**(n-2)-2*(n-1)*C(n-2,(n-2)/2)))
        else: return str(int((n+1)*2**(n-2)-(n-1)*C(n-1,(n-1)/2))) # Indranil Ghosh, Feb 19 2017

Formula

a(n) = (n+1)2^(n-2) - 2(n-1)binomial(n-2,(n-2)/2) for n even, a(n) = (n+1)2^(n-2) - (n-1)binomial(n-1,(n-1)/2) for n odd.

A153335 Number of zig-zag paths from top to bottom of an n X n square whose color is not that of the top right corner.

Original entry on oeis.org

0, 1, 2, 8, 18, 52, 116, 296, 650, 1556, 3372, 7768, 16660, 37416, 79592, 175568, 371034, 807604, 1697660, 3657464, 7654460, 16357496, 34106712, 72407728, 150499908, 317777032, 658707896, 1384524656, 2863150440, 5994736336
Offset: 1

Views

Author

Joseph Myers, Dec 24 2008

Keywords

Crossrefs

Programs

  • Mathematica
    Table[If[Mod[n,2]==0, (n+1)*2^(n-2)-2(n-1) Binomial[n-2,(n-2)/2], (n+1)*2^(n-2)-(n) Binomial[n-1,(n-1)/2]],{n,1,30}] (* Indranil Ghosh, Feb 19 2017 *)
  • PARI
    a(n) = if (n % 2, (n+1)*2^(n-2) - n*binomial(n-1,(n-1)/2), (n+1)*2^(n-2) - 2*(n-1)*binomial(n-2,(n-2)/2)); \\ Michel Marcus, Feb 19 2017
  • Python
    import math
    def C(n, r):
        f=math.factorial
        return f(n)/f(r)/f(n-r)
    def A153335(n):
        if n%2==0: return str(int((n+1)*2**(n-2)-2*(n-1)*C(n-2, (n-2)/2)))
        else: return str(int((n+1)*2**(n-2)-(n)*C(n-1, (n-1)/2))) # Indranil Ghosh, Feb 19 2017
    

Formula

a(n) = (n+1)2^(n-2) - 2(n-1)binomial(n-2,(n-2)/2) for n even, a(n) = (n+1)2^(n-2) - (n)binomial(n-1,(n-1)/2) for n odd.

A153336 Number of zig-zag paths from top to bottom of a 2n by 2n square whose color is that of the top right corner.

Original entry on oeis.org

1, 8, 52, 296, 1556, 7768, 37416, 175568, 807604, 3657464, 16357496, 72407728, 317777032, 1384524656, 5994736336, 25816193952, 110652549620, 472302724408, 2008499580504, 8513063608304, 35975584631128, 151621915797840
Offset: 1

Views

Author

Joseph Myers, Dec 24 2008, Dec 31 2008

Keywords

Examples

			a(3) = (2*3 + 1)*2 ^ (2*3 - 2) - 2*(2*3 - 1) * binomial(2*3 - 2, 3 - 1) = 52. - _Indranil Ghosh_, Feb 19 2017
		

Crossrefs

Programs

  • Mathematica
    Table[(2n+1) 2^(2n-2)-2(2n-1) Binomial[2n-2,n-1],{n,1,22}] (* Indranil Ghosh, Feb 19 2017 *)
  • PARI
    a(n) = (2*n+1)*2^(2*n-2) - 2*(2*n-1)*binomial(2*n-2, n-1); \\ Michel Marcus, Feb 19 2017
  • Python
    import math
    def C(n,r):
        f=math.factorial
        return f(n)/f(r)/f(n-r)
    def A153336(n):
        return str((2*n+1)*2**(2*n-2)-2*(2*n-1)*C(2*n-2,n-1)) # Indranil Ghosh, Feb 19 2017
    

Formula

a(n) = (2n+1)2^(2n-2) - 2(2n-1)binomial(2n-2,n-1).

A153337 Number of zig-zag paths from top to bottom of a 2n-1 by 2n-1 square whose color is that of the top right corner.

Original entry on oeis.org

1, 4, 24, 136, 720, 3624, 17584, 83024, 383904, 1746280, 7839216, 34812144, 153204064, 669108496, 2903267040, 12526343584, 53779871552, 229895033832, 978965187184, 4154438114480, 17575883030496, 74150192517808
Offset: 1

Views

Author

Joseph Myers, Dec 24 2008

Keywords

Examples

			a(3) = 3 * 2 ^ (2*3 - 2) - 2* (3 - 1) * binomial(2*3 - 2, 3 - 1) = 24. - _Indranil Ghosh_, Feb 19 2017
		

Crossrefs

Programs

  • Mathematica
    Table[(n)2^(2n-2)-2(n-1) Binomial[2n-2,n-1],{n,1,22}] (* Indranil Ghosh, Feb 19 2017 *)
  • PARI
    a(n) = n*2^(2*n-2) - 2*(n-1)*binomial(2*n-2,n-1); \\ Michel Marcus, Feb 19 2017
  • Python
    import math
    def C(n,r):
        f=math.factorial
        return f(n)/f(r)/f(n-r)
    def A153337(n):
        return str(n*2**(2*n-2)-2*(n-1)*C(2*n-2,n-1)) # Indranil Ghosh, Feb 19 2017
    

Formula

a(n) = n*2^(2n-2) - 2(n-1)*binomial(2n-2,n-1).

A152086 a(n) = Sum_{k=1..n-1} k*A110971(n,k).

Original entry on oeis.org

1, 3, 8, 21, 52, 126, 296, 685, 1556, 3498, 7768, 17122, 37416, 81308, 175568, 377469, 807604, 1721970, 3657464, 7746838, 16357496, 34459428, 72407728, 151851986, 317777032, 663908196, 1384524656, 2883208740, 5994736336, 12448784824, 25816193952, 53479331357, 110652549620
Offset: 2

Views

Author

N. J. A. Sloane, Sep 20 2009

Keywords

Crossrefs

Main diagonal of A377000.

Programs

  • Mathematica
    A110971[n_] := (n+1)*2^(n-2) - If[OddQ[n], (n-1/2)*Binomial[n-1, (n-1)/2], 2*(n-1)*Binomial[n-2, (n-2)/2]];
    Array[A110971, 50, 2] (* Paolo Xausa, Oct 13 2024 *)
  • Python
    from math import comb
    def A152086(n): return ((n+1<>1)>>1 if n&1 else (n-1)*comb(n-2,n-2>>1)<<1)) # Chai Wah Wu, Oct 28 2024

Formula

a(n) = A102699(n)/2. - Paolo Xausa, Oct 13 2024, from N. J. A. Sloane formula in A102699.

Extensions

More terms from Paolo Xausa, Oct 13 2024

A377000 Array read by ascending antidiagonals: T(n,k) = number of n-esthetic numbers with k digits.

Original entry on oeis.org

1, 2, 1, 3, 3, 1, 4, 5, 4, 1, 5, 7, 8, 6, 1, 6, 9, 12, 13, 8, 1, 7, 11, 16, 21, 21, 12, 1, 8, 13, 20, 29, 36, 34, 16, 1, 9, 15, 24, 37, 52, 63, 55, 24, 1, 10, 17, 28, 45, 68, 94, 108, 89, 32, 1, 11, 19, 32, 53, 84, 126, 169, 189, 144, 48, 1, 12, 21, 36, 61, 100, 158, 232, 305, 324, 233, 64, 1
Offset: 2

Views

Author

Paolo Xausa, Oct 12 2024

Keywords

Comments

A number is n-esthetic if, when written in base n, adjacent digits differ by 1: see De Koninck and Doyon (2009), where T(n,k) is denoted by N_q(r).

Examples

			Array begins (cf. De Koninck and Doyon (2009), table on p. 155):
  n\k| 1   2   3   4    5    6    7    8     9    10  ...
  -------------------------------------------------------
   2 | 1,  1,  1,  1,   1,   1,   1,   1,    1,    1, ... = A000012
   3 | 2,  3,  4,  6,   8,  12,  16,  24,   32,   48, ... = A029744 (from n = 2)
   4 | 3,  5,  8, 13,  21,  34,  55,  89,  144,  233, ... = A000045 (from n = 4)
   5 | 4,  7, 12, 21,  36,  63, 108, 189,  324,  567, ... = A228879
   6 | 5,  9, 16, 29,  52,  94, 169, 305,  549,  990, ...
   7 | 6, 11, 20, 37,  68, 126, 232, 430,  792, 1468, ...
   8 | 7, 13, 24, 45,  84, 158, 296, 557, 1045, 1966, ...
   9 | 8, 15, 28, 53, 100, 190, 360, 685, 1300, 2475, ...
  10 | 9, 17, 32, 61, 116, 222, 424, 813, 1556, 2986, ... = A090994
  ...                                               \______ A152086 (main diagonal)
		

Crossrefs

Cf. A000012 (row n = 2), A029744 (row n = 3), A000045 (row n = 4), A228879 (row n = 5), A090994 (row n = 10).
Cf. A102699, A152086 (main diagonal).
Diagonal above the main diagonal appears to be A206603.

Programs

  • Mathematica
    A377000[n_, k_] := Round[2^k/(n+1)*Sum[If[m != (n+1)/2, Cos[#]^k*(Cot[#] + Csc[#])^2 & [Pi*m/(n+1)], 0], {m, 1, n, 2}]];
    Table[A377000[n-k+1, k], {n, 2, 15}, {k, n-1}]
  • Python
    from itertools import count, islice
    from functools import lru_cache
    @lru_cache(maxsize=None)
    def A377000_N(q,r,i):
        if r==1 and i==0: return 0
        if r==1: return 1
        if q==2: return r+i&1^1
        if i == 0: return A377000_N(q,r-1,1)
        if i == q-1: return A377000_N(q,r-1,q-2)
        return A377000_N(q,r-1,i-1)+A377000_N(q,r-1,i+1)
    def A377000_T(n,k): return sum(A377000_N(n,k,i) for i in range(n))
    def A377000_gen(): # generator of terms
        for n in count(2):
            for k in range(1,n):
                yield A377000_T(n-k+1,k)
    A377000_list = list(islice(A377000_gen(),100)) # Chai Wah Wu, Oct 21 2024

Formula

All of the following formulas are taken from De Koninck and Doyon (2009).
T(n,k) = 2^k/(n+1) * Sum_{m=1..n, m odd, m != (n+1)/2} cos(p)^k*(cot(p) + csc(p))^2, where p = Pi*m/(n+1).
T(n,1) = n - 1.
T(2,k) = 1.
T(3,k) = 2^((k+1)/2) if k is odd, 3*2^((k-2)/2) if k is even = A029744(k+1).
T(4,k) = A000045(k+3).
T(5,k) = 4*3^((k-1)/2) if k is odd, 7*3^((k-2)/2) if k is even = A228879(k-1).
Conjectures from Chai Wah Wu, Oct 21 2024: (Start)
Conjecture 1: For even n, T(n,k) is the number of meaningful differential operations of the k-th order on the space R^(n-1).
Conjecture 2: For each n, the row T(n,k) satisfies a linear recurrence. For example:
T(6,k) = T(6,k-1) + 2*T(6,k-2) - T(6,k-3) for k > 3 (A090990).
T(7,k) = 4*T(7,k-2) - 2*T(7,k-4) for k > 4.
T(8,k) = T(8,k-1) + 3*T(8,k-2) - 2*T(8,k-3) - T(8,k-4) for k > 4 (A090992).
T(9,k) = 5*T(9,k-2) - 5*T(9,k-4) for k > 4.
T(10,k) = T(10,k-1) + 4*T(10,k-2) - 3*T(10,k-3) - 3*T(10,k-4) + T(10,k-5) for k > 5.
T(11,k) = 6*T(11,k-2) - 9*T(11,k-4) + 2*T(11,k-6) for k > 6.
T(12,k) = T(12,k-1) + 5*T(12,k-2) - 4*T(12,k-3) - 6*T(12,k-4) + 3*T(12,k-5) + T(12,k-6) for k > 6 (A129638).
...
Note that for even n, Conjecture 1 implies Conjecture 2 due to (Malesevic, 1998).
Conjecture 3: T(n,n-2) = A182555(n-2). (End)

A110971 Triangle T(n,k) (n >= 2, 1 <= k <= n-1) read by rows: row n gives epispectrum of a path P_n (see reference for precise definition).

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 1, 2, 4, 1, 1, 2, 6, 6, 1, 1, 2, 7, 11, 10, 1, 1, 2, 8, 14, 24, 14, 1, 1, 2, 9, 16, 35, 42, 22, 1, 1, 2, 10, 18, 45, 68, 81, 30, 1, 1, 2, 11, 20, 55, 89, 149, 138, 46, 1, 1, 2, 12, 22, 66, 110, 216, 282, 250, 62, 1, 1, 2, 13, 24, 78, 132, 285, 422, 577, 419
Offset: 2

Views

Author

N. J. A. Sloane, Sep 20 2009

Keywords

Examples

			Triangle begins:
  1;
  1, 1;
  1, 2,  1;
  1, 2,  4,  1;
  1, 2,  6,  6,  1;
  1, 2,  7, 11, 10,   1;
  1, 2,  8, 14, 24,  14,   1;
  1, 2,  9, 16, 35,  42,  22,   1;
  1, 2, 10, 18, 45,  68,  81,  30,   1;
  1, 2, 11, 20, 55,  89, 149, 138,  46,    1;
  1, 2, 12, 22, 66, 110, 216, 282, 250,   62,   1;
  1, 2, 13, 24, 78, 132, 285, 422, 577,  419,  94,   1;
  1, 2, 14, 26, 91, 156, 364, 568, 945, 1070, 732, 126, 1;
		

Crossrefs

A198335 Triangle read by rows: T(n,k) is 1/2 of the number of walks of length k (1<=k<=n-1) in the path graph on n vertices (n>=2).

Original entry on oeis.org

1, 2, 3, 3, 5, 8, 4, 7, 12, 21, 5, 9, 16, 29, 52, 6, 11, 20, 37, 68, 126, 7, 13, 24, 45, 84, 158, 296, 8, 15, 28, 53, 100, 190, 360, 685, 9, 17, 32, 61, 116, 222, 424, 813, 1556, 10, 19, 36, 69, 132, 254, 488, 941, 1812, 3498, 11, 21, 40, 77, 148, 286, 552, 1069, 2068, 4010, 7768
Offset: 2

Views

Author

Emeric Deutsch, Dec 01 2011

Keywords

Comments

Sum of entries in row n is A144952(n) (n>=2).
T(n,n-1)=(1/2)A102699(n).

Examples

			T(3,1)=2 and T(3,2)=3 because in the path a - b - c we have 4 walks of length 1 (ab, bc, ba, cb) and 6 walks of length 2 (aba, abc, bab, bcb, cbc, cba).
Triangle starts:
1;
2,3;
3,5,8;
4,7,12,21;
5,9,16,29,52;
		

References

  • G. Rucker and C. Rucker, Walk counts, labyrinthicity and complexity of acyclic and cyclic graphs and molecules, J. Chem. Inf. Comput. Sci., 40 (2000), 99-106.

Crossrefs

Programs

  • Maple
    with(GraphTheory): T := proc (n, k) local G, A, B: G := PathGraph(n): A := AdjacencyMatrix(G): B := A^k: if k < n then (1/2)*add(add(B[i, j], i = 1 .. n), j = 1 .. n) else 0 end if end proc: for n from 2 to 12 do seq(T(n, k), k = 1 .. n-1) end do; # yields sequence in triangular form

Formula

It is known that if A is the adjacency matrix of a graph G, then the (i,j)-entry of the matrix A^k is equal to the number of walks from vertex i to vertex j. Consequently, T(n,k) is 1/2 of the sum of the entries of the matrix A^k (see the Maple program).

Extensions

Keyword tabl added by Michel Marcus, Apr 09 2013
Showing 1-10 of 11 results. Next